Commit 74ccc4b5 authored by Dick Hollenbeck's avatar Dick Hollenbeck

++common

  * changed all the RotatePoint() functions in trigo.{h,cpp} to take a double as the
    angle, which is still in tenths of degrees for now.
  * EDA_TEXT::m_Orient is now double, still in tenths of degrees (for a short while),
    but the double means parsing files and saving them use a different format string.
++pcbnew
  * DRAWSEGMENT::GetStart() and GetEnd() do not operate for S_ARC like they used to.
    They are now simply accessors for m_Start and m_End.  Use DRAWSEGMENT::GetArcStart()
    and GetArcEnd() and GetCenter() for arcs.  specctra_export.cpp was the only
    source file dependent on the old behavior.
  * DIMENSION::m_Text is now contained, not dynamically allocated.
  * more kicad_plugin work.
parents bced8c97 96bb90de
...@@ -568,11 +568,14 @@ void EDA_3D_CANVAS::Draw3D_DrawSegment( DRAWSEGMENT* segment ) ...@@ -568,11 +568,14 @@ void EDA_3D_CANVAS::Draw3D_DrawSegment( DRAWSEGMENT* segment )
int color = g_ColorsSettings.GetLayerColor( layer ); int color = g_ColorsSettings.GetLayerColor( layer );
SetGLColor( color ); SetGLColor( color );
w = segment->m_Width * g_Parm_3D_Visu.m_BoardScale;
x = segment->m_Start.x * g_Parm_3D_Visu.m_BoardScale; w = segment->GetWidth() * g_Parm_3D_Visu.m_BoardScale;
y = segment->m_Start.y * g_Parm_3D_Visu.m_BoardScale;
xf = segment->m_End.x * g_Parm_3D_Visu.m_BoardScale; x = segment->GetStart().x * g_Parm_3D_Visu.m_BoardScale;
yf = segment->m_End.y * g_Parm_3D_Visu.m_BoardScale; y = segment->GetStart().y * g_Parm_3D_Visu.m_BoardScale;
xf = segment->GetEnd().x * g_Parm_3D_Visu.m_BoardScale;
yf = segment->GetEnd().y * g_Parm_3D_Visu.m_BoardScale;
if( layer == EDGE_N ) if( layer == EDGE_N )
{ {
...@@ -581,10 +584,10 @@ void EDA_3D_CANVAS::Draw3D_DrawSegment( DRAWSEGMENT* segment ) ...@@ -581,10 +584,10 @@ void EDA_3D_CANVAS::Draw3D_DrawSegment( DRAWSEGMENT* segment )
glNormal3f( 0.0, 0.0, (layer == LAYER_N_BACK) ? -1.0 : 1.0 ); glNormal3f( 0.0, 0.0, (layer == LAYER_N_BACK) ? -1.0 : 1.0 );
zpos = g_Parm_3D_Visu.m_LayerZcoord[layer]; zpos = g_Parm_3D_Visu.m_LayerZcoord[layer];
switch( segment->m_Shape ) switch( segment->GetShape() )
{ {
case S_ARC: case S_ARC:
Draw3D_ArcSegment( x, -y, xf, -yf, (double) segment->m_Angle, w, zpos ); Draw3D_ArcSegment( x, -y, xf, -yf, segment->GetAngle(), w, zpos );
break; break;
case S_CIRCLE: case S_CIRCLE:
...@@ -604,10 +607,10 @@ void EDA_3D_CANVAS::Draw3D_DrawSegment( DRAWSEGMENT* segment ) ...@@ -604,10 +607,10 @@ void EDA_3D_CANVAS::Draw3D_DrawSegment( DRAWSEGMENT* segment )
if( Get3DLayerEnable( layer ) ) if( Get3DLayerEnable( layer ) )
{ {
switch( segment->m_Shape ) switch( segment->GetShape() )
{ {
case S_ARC: case S_ARC:
Draw3D_ArcSegment( x, -y, xf, -yf, (double) segment->m_Angle, w, zpos ); Draw3D_ArcSegment( x, -y, xf, -yf, segment->GetAngle(), w, zpos );
break; break;
case S_CIRCLE: case S_CIRCLE:
......
...@@ -5,6 +5,22 @@ Please add newer entries at the top, list the date and your name with ...@@ -5,6 +5,22 @@ Please add newer entries at the top, list the date and your name with
email address. email address.
2011-Dec-13 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
++common
* changed all the RotatePoint() functions in trigo.{h,cpp} to take a double as the
angle, which is still in tenths of degrees for now.
* EDA_TEXT::m_Orient is now double, still in tenths of degrees (for a short while),
but the double means parsing files and saving them use a different format string.
++pcbnew
* DRAWSEGMENT::GetStart() and GetEnd() do not operate for S_ARC like they used to.
They are now simply accessors for m_Start and m_End. Use DRAWSEGMENT::GetArcStart()
and GetArcEnd() and GetCenter() for arcs. specctra_export.cpp was the only
source file dependent on the old behavior.
* DIMENSION::m_Text is now contained, not dynamically allocated.
* more kicad_plugin work.
2011-Dec-9 UPDATE Dick Hollenbeck <dick@softplc.com> 2011-Dec-9 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================ ================================================================================
++PCBNew ++PCBNew
......
...@@ -215,7 +215,7 @@ int ArcTangente( int dy, int dx ) ...@@ -215,7 +215,7 @@ int ArcTangente( int dy, int dx )
} }
void RotatePoint( int* pX, int* pY, int angle ) void RotatePoint( int* pX, int* pY, double angle )
{ {
int tmp; int tmp;
...@@ -248,7 +248,7 @@ void RotatePoint( int* pX, int* pY, int angle ) ...@@ -248,7 +248,7 @@ void RotatePoint( int* pX, int* pY, int angle )
} }
else else
{ {
double fangle = DEG2RAD( (double) angle / 10.0 ); double fangle = DEG2RAD( angle / 10.0 );
double sinus = sin( fangle ); double sinus = sin( fangle );
double cosinus = cos( fangle ); double cosinus = cos( fangle );
double fpx = (*pY * sinus ) + (*pX * cosinus ); double fpx = (*pY * sinus ) + (*pX * cosinus );
...@@ -259,7 +259,7 @@ void RotatePoint( int* pX, int* pY, int angle ) ...@@ -259,7 +259,7 @@ void RotatePoint( int* pX, int* pY, int angle )
} }
void RotatePoint( int* pX, int* pY, int cx, int cy, int angle ) void RotatePoint( int* pX, int* pY, int cx, int cy, double angle )
{ {
int ox, oy; int ox, oy;
...@@ -273,7 +273,7 @@ void RotatePoint( int* pX, int* pY, int cx, int cy, int angle ) ...@@ -273,7 +273,7 @@ void RotatePoint( int* pX, int* pY, int cx, int cy, int angle )
} }
void RotatePoint( wxPoint* point, int angle ) void RotatePoint( wxPoint* point, double angle )
{ {
int ox, oy; int ox, oy;
...@@ -286,7 +286,7 @@ void RotatePoint( wxPoint* point, int angle ) ...@@ -286,7 +286,7 @@ void RotatePoint( wxPoint* point, int angle )
} }
void RotatePoint( wxPoint* point, const wxPoint& centre, int angle ) void RotatePoint( wxPoint* point, const wxPoint& centre, double angle )
{ {
int ox, oy; int ox, oy;
...@@ -299,7 +299,7 @@ void RotatePoint( wxPoint* point, const wxPoint& centre, int angle ) ...@@ -299,7 +299,7 @@ void RotatePoint( wxPoint* point, const wxPoint& centre, int angle )
} }
void RotatePoint( double* pX, double* pY, double cx, double cy, int angle ) void RotatePoint( double* pX, double* pY, double cx, double cy, double angle )
{ {
double ox, oy; double ox, oy;
...@@ -313,7 +313,7 @@ void RotatePoint( double* pX, double* pY, double cx, double cy, int angle ) ...@@ -313,7 +313,7 @@ void RotatePoint( double* pX, double* pY, double cx, double cy, int angle )
} }
void RotatePoint( double* pX, double* pY, int angle ) void RotatePoint( double* pX, double* pY, double angle )
{ {
double tmp; double tmp;
...@@ -346,7 +346,7 @@ void RotatePoint( double* pX, double* pY, int angle ) ...@@ -346,7 +346,7 @@ void RotatePoint( double* pX, double* pY, int angle )
} }
else else
{ {
double fangle = DEG2RAD( (double) angle / 10.0 ); double fangle = DEG2RAD( angle / 10.0 );
double sinus = sin( fangle ); double sinus = sin( fangle );
double cosinus = cos( fangle ); double cosinus = cos( fangle );
......
...@@ -72,7 +72,7 @@ bool LIB_TEXT::Save( OUTPUTFORMATTER& aFormatter ) ...@@ -72,7 +72,7 @@ bool LIB_TEXT::Save( OUTPUTFORMATTER& aFormatter )
text.Replace( wxT( " " ), wxT( "~" ) ); text.Replace( wxT( " " ), wxT( "~" ) );
} }
aFormatter.Print( 0, "T %d %d %d %d %d %d %d %s ", m_Orient, m_Pos.x, m_Pos.y, aFormatter.Print( 0, "T %g %d %d %d %d %d %d %s ", GetOrientation(), m_Pos.x, m_Pos.y,
m_Size.x, m_Attributs, m_Unit, m_Convert, TO_UTF8( text ) ); m_Size.x, m_Attributs, m_Unit, m_Convert, TO_UTF8( text ) );
aFormatter.Print( 0, " %s %d", m_Italic ? "Italic" : "Normal", ( m_Bold > 0 ) ? 1 : 0 ); aFormatter.Print( 0, " %s %d", m_Italic ? "Italic" : "Normal", ( m_Bold > 0 ) ? 1 : 0 );
...@@ -104,12 +104,13 @@ bool LIB_TEXT::Load( LINE_READER& aLineReader, wxString& errorMsg ) ...@@ -104,12 +104,13 @@ bool LIB_TEXT::Load( LINE_READER& aLineReader, wxString& errorMsg )
char buf[256]; char buf[256];
char tmp[256]; char tmp[256];
char* line = (char*) aLineReader; char* line = (char*) aLineReader;
double angle;
buf[0] = 0; buf[0] = 0;
tmp[0] = 0; // For italic option, Not in old versions tmp[0] = 0; // For italic option, Not in old versions
cnt = sscanf( line + 2, "%d %d %d %d %d %d %d \"%[^\"]\" %s %d %c %c", cnt = sscanf( line + 2, "%lf %d %d %d %d %d %d \"%[^\"]\" %s %d %c %c",
&m_Orient, &m_Pos.x, &m_Pos.y, &m_Size.x, &m_Attributs, &angle, &m_Pos.x, &m_Pos.y, &m_Size.x, &m_Attributs,
&m_Unit, &m_Convert, buf, tmp, &thickness, &hjustify, &m_Unit, &m_Convert, buf, tmp, &thickness, &hjustify,
&vjustify ); &vjustify );
...@@ -123,7 +124,7 @@ bool LIB_TEXT::Load( LINE_READER& aLineReader, wxString& errorMsg ) ...@@ -123,7 +124,7 @@ bool LIB_TEXT::Load( LINE_READER& aLineReader, wxString& errorMsg )
else else
{ {
cnt = sscanf( line + 2, "%d %d %d %d %d %d %d %s %s %d %c %c", cnt = sscanf( line + 2, "%d %d %d %d %d %d %d %s %s %d %c %c",
&m_Orient, &m_Pos.x, &m_Pos.y, &m_Size.x, &m_Attributs, &angle, &m_Pos.x, &m_Pos.y, &m_Size.x, &m_Attributs,
&m_Unit, &m_Convert, buf, tmp, &thickness, &hjustify, &m_Unit, &m_Convert, buf, tmp, &thickness, &hjustify,
&vjustify ); &vjustify );
...@@ -138,6 +139,8 @@ bool LIB_TEXT::Load( LINE_READER& aLineReader, wxString& errorMsg ) ...@@ -138,6 +139,8 @@ bool LIB_TEXT::Load( LINE_READER& aLineReader, wxString& errorMsg )
m_Text.Replace( wxT( "~" ), wxT( " " ) ); m_Text.Replace( wxT( "~" ), wxT( " " ) );
} }
SetOrientation( angle );
m_Size.y = m_Size.x; m_Size.y = m_Size.x;
if( strnicmp( tmp, "Italic", 6 ) == 0 ) if( strnicmp( tmp, "Italic", 6 ) == 0 )
......
...@@ -72,7 +72,7 @@ GERBER_DRAW_ITEM::GERBER_DRAW_ITEM( const GERBER_DRAW_ITEM& aSource ) : ...@@ -72,7 +72,7 @@ GERBER_DRAW_ITEM::GERBER_DRAW_ITEM( const GERBER_DRAW_ITEM& aSource ) :
m_Flags = aSource.m_Flags; m_Flags = aSource.m_Flags;
SetTimeStamp( aSource.m_TimeStamp ); SetTimeStamp( aSource.m_TimeStamp );
SetStatus( aSource.ReturnStatus() ); SetStatus( aSource.GetStatus() );
m_Start = aSource.m_Start; m_Start = aSource.m_Start;
m_End = aSource.m_End; m_End = aSource.m_End;
m_Size = aSource.m_Size; m_Size = aSource.m_Size;
......
...@@ -256,9 +256,9 @@ void GBR_TO_PCB_EXPORTER::export_non_copper_item( GERBER_DRAW_ITEM* aGbrItem, in ...@@ -256,9 +256,9 @@ void GBR_TO_PCB_EXPORTER::export_non_copper_item( GERBER_DRAW_ITEM* aGbrItem, in
DRAWSEGMENT* drawitem = new DRAWSEGMENT( m_pcb, PCB_LINE_T ); DRAWSEGMENT* drawitem = new DRAWSEGMENT( m_pcb, PCB_LINE_T );
drawitem->SetLayer( aLayer ); drawitem->SetLayer( aLayer );
drawitem->m_Start = aGbrItem->m_Start; drawitem->SetStart( aGbrItem->m_Start );
drawitem->m_End = aGbrItem->m_End; drawitem->SetEnd( aGbrItem->m_End );
drawitem->m_Width = aGbrItem->m_Size.x; drawitem->SetWidth( aGbrItem->m_Size.x );
if( aGbrItem->m_Shape == GBR_ARC ) if( aGbrItem->m_Shape == GBR_ARC )
{ {
...@@ -267,20 +267,20 @@ void GBR_TO_PCB_EXPORTER::export_non_copper_item( GERBER_DRAW_ITEM* aGbrItem, in ...@@ -267,20 +267,20 @@ void GBR_TO_PCB_EXPORTER::export_non_copper_item( GERBER_DRAW_ITEM* aGbrItem, in
double b = atan2( (double)( aGbrItem->m_End.y - aGbrItem->m_ArcCentre.y ), double b = atan2( (double)( aGbrItem->m_End.y - aGbrItem->m_ArcCentre.y ),
(double)( aGbrItem->m_End.x - aGbrItem->m_ArcCentre.x ) ); (double)( aGbrItem->m_End.x - aGbrItem->m_ArcCentre.x ) );
drawitem->m_Shape = S_ARC; drawitem->SetShape( S_ARC );
drawitem->m_Angle = wxRound( (a - b) / M_PI * 1800.0 ); drawitem->SetAngle( wxRound( (a - b) / M_PI * 1800.0 ) );
drawitem->m_Start = aGbrItem->m_ArcCentre; drawitem->SetStart( aGbrItem->m_ArcCentre );
if( drawitem->m_Angle < 0 ) if( drawitem->GetAngle() < 0 )
{ {
NEGATE( drawitem->m_Angle ); drawitem->SetAngle( -drawitem->GetAngle() );
drawitem->m_End = aGbrItem->m_Start; drawitem->SetEnd( aGbrItem->m_Start );
} }
} }
// Reverse Y axis: // Reverse Y axis:
NEGATE( drawitem->m_Start.y ); drawitem->SetStartY( -drawitem->GetStart().y );
NEGATE( drawitem->m_End.y ); drawitem->SetEndY( -drawitem->GetEnd().y );
m_pcb->Add( drawitem ); m_pcb->Add( drawitem );
} }
......
...@@ -447,7 +447,6 @@ public: ...@@ -447,7 +447,6 @@ public:
return m_Status & type; return m_Status & type;
} }
void SetState( int type, int state ) void SetState( int type, int state )
{ {
if( state ) if( state )
...@@ -456,13 +455,8 @@ public: ...@@ -456,13 +455,8 @@ public:
m_Status &= ~type; m_Status &= ~type;
} }
int GetStatus() const { return m_Status; }
int ReturnStatus() const { return m_Status; } void SetStatus( int aStatus ) { m_Status = aStatus; }
void SetStatus( int new_status )
{
m_Status = new_status;
}
void SetFlags( int aMask ) { m_Flags |= aMask; } void SetFlags( int aMask ) { m_Flags |= aMask; }
void ClearFlags( int aMask = EDA_ITEM_ALL_FLAGS ) { m_Flags &= ~aMask; } void ClearFlags( int aMask = EDA_ITEM_ALL_FLAGS ) { m_Flags &= ~aMask; }
...@@ -798,7 +792,7 @@ class EDA_TEXT ...@@ -798,7 +792,7 @@ class EDA_TEXT
public: public:
wxString m_Text; wxString m_Text;
int m_Thickness; ///< pen size used to draw this text int m_Thickness; ///< pen size used to draw this text
int m_Orient; ///< Orient in 0.1 degrees double m_Orient; ///< Orient in 0.1 degrees
wxPoint m_Pos; ///< XY position of anchor text. wxPoint m_Pos; ///< XY position of anchor text.
wxSize m_Size; ///< XY size of text wxSize m_Size; ///< XY size of text
bool m_Mirror; ///< true iff mirrored bool m_Mirror; ///< true iff mirrored
...@@ -832,8 +826,8 @@ public: ...@@ -832,8 +826,8 @@ public:
*/ */
int GetThickness() const { return m_Thickness; }; int GetThickness() const { return m_Thickness; };
void SetOrientation( int aOrientation ) { m_Orient = aOrientation; } void SetOrientation( double aOrientation ) { m_Orient = aOrientation; }
int GetOrientation() const { return m_Orient; } double GetOrientation() const { return m_Orient; }
void SetItalic( bool isItalic ) { m_Italic = isItalic; } void SetItalic( bool isItalic ) { m_Italic = isItalic; }
bool IsItalic() const { return m_Italic; } bool IsItalic() const { return m_Italic; }
......
...@@ -194,7 +194,7 @@ public: ...@@ -194,7 +194,7 @@ public:
* @param aRotCentre - the rotation point. * @param aRotCentre - the rotation point.
* @param aAngle - the rotation angle in 0.1 degree. * @param aAngle - the rotation angle in 0.1 degree.
*/ */
virtual void Rotate( const wxPoint& aRotCentre, int aAngle ) virtual void Rotate( const wxPoint& aRotCentre, double aAngle )
{ {
wxMessageBox( wxT( "virtual BOARD_ITEM::Rotate used, should not occur" ), GetClass() ); wxMessageBox( wxT( "virtual BOARD_ITEM::Rotate used, should not occur" ), GetClass() );
} }
......
...@@ -43,7 +43,7 @@ public: ...@@ -43,7 +43,7 @@ public:
* Function GetCount * Function GetCount
* @return the number of items stored in list * @return the number of items stored in list
*/ */
unsigned GetCount() { return m_List.size(); } unsigned GetCount() const { return m_List.size(); }
/** /**
* Function GetModuleInfo * Function GetModuleInfo
......
...@@ -10,29 +10,29 @@ ...@@ -10,29 +10,29 @@
* Calculate the new point of coord coord pX, pY, * Calculate the new point of coord coord pX, pY,
* for a rotation center 0, 0, and angle in (1 / 10 degree) * for a rotation center 0, 0, and angle in (1 / 10 degree)
*/ */
void RotatePoint( int *pX, int *pY, int angle ); void RotatePoint( int *pX, int *pY, double angle );
/* /*
* Calculate the new point of coord coord pX, pY, * Calculate the new point of coord coord pX, pY,
* for a rotation center cx, cy, and angle in (1 / 10 degree) * for a rotation center cx, cy, and angle in (1 / 10 degree)
*/ */
void RotatePoint( int *pX, int *pY, int cx, int cy, int angle ); void RotatePoint( int *pX, int *pY, int cx, int cy, double angle );
/* /*
* Calculates the new coord point point * Calculates the new coord point point
* for a rotation angle in (1 / 10 degree) * for a rotation angle in (1 / 10 degree)
*/ */
void RotatePoint( wxPoint* point, int angle ); void RotatePoint( wxPoint* point, double angle );
/* /*
* Calculates the new coord point point * Calculates the new coord point point
* for a center rotation center and angle in (1 / 10 degree) * for a center rotation center and angle in (1 / 10 degree)
*/ */
void RotatePoint( wxPoint *point, const wxPoint & centre, int angle ); void RotatePoint( wxPoint *point, const wxPoint & centre, double angle );
void RotatePoint( double *pX, double *pY, int angle ); void RotatePoint( double *pX, double *pY, double angle );
void RotatePoint( double *pX, double *pY, double cx, double cy, int angle ); void RotatePoint( double *pX, double *pY, double cx, double cy, double angle );
/* Return the arc tangent of 0.1 degrees coord vector dx, dy /* Return the arc tangent of 0.1 degrees coord vector dx, dy
* between -1800 and 1800 * between -1800 and 1800
......
...@@ -519,10 +519,10 @@ int PCB_EDIT_FRAME::GenPlaceBoard() ...@@ -519,10 +519,10 @@ int PCB_EDIT_FRAME::GenPlaceBoard()
if( DrawSegm->GetLayer() != EDGE_N ) if( DrawSegm->GetLayer() != EDGE_N )
break; break;
TmpSegm.m_Start = DrawSegm->m_Start; TmpSegm.SetStart( DrawSegm->GetStart() );
TmpSegm.m_End = DrawSegm->m_End; TmpSegm.SetEnd( DrawSegm->GetEnd() );
TmpSegm.m_Shape = DrawSegm->m_Shape; TmpSegm.SetShape( DrawSegm->GetShape() );
TmpSegm.m_Param = DrawSegm->m_Angle; TmpSegm.m_Param = DrawSegm->GetAngle();
TraceSegmentPcb( GetBoard(), &TmpSegm, HOLE | CELL_is_EDGE, TraceSegmentPcb( GetBoard(), &TmpSegm, HOLE | CELL_is_EDGE,
Board.m_GridRouting, WRITE_CELL ); Board.m_GridRouting, WRITE_CELL );
......
...@@ -483,10 +483,10 @@ void MoveMarkedItems( MODULE* module, wxPoint offset ) ...@@ -483,10 +483,10 @@ void MoveMarkedItems( MODULE* module, wxPoint offset )
case PCB_MODULE_EDGE_T: case PCB_MODULE_EDGE_T:
{ {
EDGE_MODULE* em = (EDGE_MODULE*) item; EDGE_MODULE* em = (EDGE_MODULE*) item;
em->m_Start += offset; em->SetStart( em->GetStart() + offset );
em->m_End += offset; em->SetEnd( em->GetEnd() + offset );
em->m_Start0 += offset; em->SetStart0( em->GetStart0() + offset );
em->m_End0 += offset; em->SetEnd0( em->GetEnd0() + offset );
} }
break; break;
...@@ -537,20 +537,17 @@ void DeleteMarkedItems( MODULE* module ) ...@@ -537,20 +537,17 @@ void DeleteMarkedItems( MODULE* module )
} }
/* Mirror marked items, refer to a Vertical axis at position offset /** Mirror marked items, refer to a Vertical axis at position offset
*/ */
void MirrorMarkedItems( MODULE* module, wxPoint offset ) void MirrorMarkedItems( MODULE* module, wxPoint offset )
{ {
#define SETMIRROR( z ) (z) -= offset.x; (z) = -(z); (z) += offset.x; #define SETMIRROR( z ) (z) -= offset.x; (z) = -(z); (z) += offset.x;
EDA_ITEM* item;
wxPoint tmp; wxPoint tmp;
if( module == NULL ) if( module == NULL )
return; return;
D_PAD* pad = module->m_Pads; for( D_PAD* pad = module->m_Pads; pad; pad = pad->Next() )
for( ; pad != NULL; pad = pad->Next() )
{ {
if( pad->m_Selected == 0 ) if( pad->m_Selected == 0 )
continue; continue;
...@@ -566,9 +563,7 @@ void MirrorMarkedItems( MODULE* module, wxPoint offset ) ...@@ -566,9 +563,7 @@ void MirrorMarkedItems( MODULE* module, wxPoint offset )
NORMALIZE_ANGLE_POS( pad->m_Orient ); NORMALIZE_ANGLE_POS( pad->m_Orient );
} }
item = module->m_Drawings; for( EDA_ITEM* item = module->m_Drawings; item; item = item->Next() )
for( ; item != NULL; item = item->Next() )
{ {
if( item->m_Selected == 0 ) if( item->m_Selected == 0 )
continue; continue;
...@@ -578,11 +573,18 @@ void MirrorMarkedItems( MODULE* module, wxPoint offset ) ...@@ -578,11 +573,18 @@ void MirrorMarkedItems( MODULE* module, wxPoint offset )
case PCB_MODULE_EDGE_T: case PCB_MODULE_EDGE_T:
{ {
EDGE_MODULE* em = (EDGE_MODULE*) item; EDGE_MODULE* em = (EDGE_MODULE*) item;
SETMIRROR( em->m_Start.x );
em->m_Start0.x = em->m_Start.x; tmp = em->GetStart0();
SETMIRROR( em->m_End.x ); SETMIRROR( tmp.x );
em->m_End0.x = em->m_End.x; em->SetStart0( tmp );
NEGATE( em->m_Angle ); em->SetStartX( tmp.x );
tmp = em->GetEnd0();
SETMIRROR( tmp.x );
em->SetEnd0( tmp );
em->SetEndX( tmp.x );
em->SetAngle( -em->GetAngle() );
} }
break; break;
...@@ -607,19 +609,16 @@ void MirrorMarkedItems( MODULE* module, wxPoint offset ) ...@@ -607,19 +609,16 @@ void MirrorMarkedItems( MODULE* module, wxPoint offset )
} }
/* Rotate marked items, refer to a Vertical axis at position offset /** Rotate marked items, refer to a Vertical axis at position offset
*/ */
void RotateMarkedItems( MODULE* module, wxPoint offset ) void RotateMarkedItems( MODULE* module, wxPoint offset )
{ {
#define ROTATE( z ) RotatePoint( (&z), offset, 900 ) #define ROTATE( z ) RotatePoint( (&z), offset, 900 )
EDA_ITEM* item;
if( module == NULL ) if( module == NULL )
return; return;
D_PAD* pad = module->m_Pads; for( D_PAD* pad = module->m_Pads; pad; pad = pad->Next() )
for( ; pad != NULL; pad = pad->Next() )
{ {
if( pad->m_Selected == 0 ) if( pad->m_Selected == 0 )
continue; continue;
...@@ -633,9 +632,7 @@ void RotateMarkedItems( MODULE* module, wxPoint offset ) ...@@ -633,9 +632,7 @@ void RotateMarkedItems( MODULE* module, wxPoint offset )
NORMALIZE_ANGLE_POS( pad->m_Orient ); NORMALIZE_ANGLE_POS( pad->m_Orient );
} }
item = module->m_Drawings; for( EDA_ITEM* item = module->m_Drawings; item; item = item->Next() )
for( ; item != NULL; item = item->Next() )
{ {
if( item->m_Selected == 0 ) if( item->m_Selected == 0 )
continue; continue;
...@@ -645,10 +642,16 @@ void RotateMarkedItems( MODULE* module, wxPoint offset ) ...@@ -645,10 +642,16 @@ void RotateMarkedItems( MODULE* module, wxPoint offset )
case PCB_MODULE_EDGE_T: case PCB_MODULE_EDGE_T:
{ {
EDGE_MODULE* em = (EDGE_MODULE*) item; EDGE_MODULE* em = (EDGE_MODULE*) item;
ROTATE( em->m_Start );
em->m_Start0 = em->m_Start; wxPoint tmp = em->GetStart();
ROTATE( em->m_End ); ROTATE( tmp );
em->m_End0 = em->m_End; em->SetStart( tmp );
em->SetStart0( tmp );
tmp = em->GetEnd();
ROTATE( tmp );
em->SetEnd( tmp );
em->SetEnd0( tmp );
} }
break; break;
......
...@@ -234,11 +234,11 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag ) ...@@ -234,11 +234,11 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
if( tmpSegm.GetLayer() == EDGE_N ) if( tmpSegm.GetLayer() == EDGE_N )
tmpSegm.SetLayer( -1 ); tmpSegm.SetLayer( -1 );
tmpSegm.m_Start = edge->m_Start; tmpSegm.SetStart( edge->GetStart() );
tmpSegm.m_End = edge->m_End; tmpSegm.SetEnd( edge->GetEnd() );
tmpSegm.m_Shape = edge->m_Shape; tmpSegm.SetShape( edge->GetShape() );
tmpSegm.m_Width = edge->m_Width; tmpSegm.SetWidth( edge->GetWidth() );
tmpSegm.m_Param = edge->m_Angle; tmpSegm.m_Param = edge->GetAngle();
tmpSegm.SetNet( -1 ); tmpSegm.SetNet( -1 );
TraceSegmentPcb( aPcb, &tmpSegm, HOLE, marge, WRITE_CELL ); TraceSegmentPcb( aPcb, &tmpSegm, HOLE, marge, WRITE_CELL );
...@@ -271,11 +271,11 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag ) ...@@ -271,11 +271,11 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
type_cell |= CELL_is_EDGE; type_cell |= CELL_is_EDGE;
} }
tmpSegm.m_Start = DrawSegm->m_Start; tmpSegm.SetStart( DrawSegm->GetStart() );
tmpSegm.m_End = DrawSegm->m_End; tmpSegm.SetEnd( DrawSegm->GetEnd() );
tmpSegm.m_Shape = DrawSegm->m_Shape; tmpSegm.SetShape( DrawSegm->GetShape() );
tmpSegm.m_Width = DrawSegm->m_Width; tmpSegm.SetWidth( DrawSegm->GetWidth() );
tmpSegm.m_Param = DrawSegm->m_Angle; tmpSegm.m_Param = DrawSegm->GetAngle();
tmpSegm.SetNet( -1 ); tmpSegm.SetNet( -1 );
TraceSegmentPcb( aPcb, &tmpSegm, type_cell, marge, WRITE_CELL ); TraceSegmentPcb( aPcb, &tmpSegm, type_cell, marge, WRITE_CELL );
......
...@@ -203,10 +203,18 @@ void SwapData( BOARD_ITEM* aItem, BOARD_ITEM* aImage ) ...@@ -203,10 +203,18 @@ void SwapData( BOARD_ITEM* aItem, BOARD_ITEM* aImage )
break; break;
case PCB_LINE_T: case PCB_LINE_T:
#if 0
EXCHG( ( (DRAWSEGMENT*) aItem )->m_Start, ( (DRAWSEGMENT*) aImage )->m_Start ); EXCHG( ( (DRAWSEGMENT*) aItem )->m_Start, ( (DRAWSEGMENT*) aImage )->m_Start );
EXCHG( ( (DRAWSEGMENT*) aItem )->m_End, ( (DRAWSEGMENT*) aImage )->m_End ); EXCHG( ( (DRAWSEGMENT*) aItem )->m_End, ( (DRAWSEGMENT*) aImage )->m_End );
EXCHG( ( (DRAWSEGMENT*) aItem )->m_Width, ( (DRAWSEGMENT*) aImage )->m_Width ); EXCHG( ( (DRAWSEGMENT*) aItem )->m_Width, ( (DRAWSEGMENT*) aImage )->m_Width );
EXCHG( ( (DRAWSEGMENT*) aItem )->m_Shape, ( (DRAWSEGMENT*) aImage )->m_Shape ); EXCHG( ( (DRAWSEGMENT*) aItem )->m_Shape, ( (DRAWSEGMENT*) aImage )->m_Shape );
#else
{
DRAWSEGMENT tmp = *(DRAWSEGMENT*) aImage;
*aImage = *aItem;
*aItem = tmp;
}
#endif
break; break;
case PCB_TRACE_T: case PCB_TRACE_T:
...@@ -231,12 +239,12 @@ void SwapData( BOARD_ITEM* aItem, BOARD_ITEM* aImage ) ...@@ -231,12 +239,12 @@ void SwapData( BOARD_ITEM* aItem, BOARD_ITEM* aImage )
EXCHG(itmp, atmp ); EXCHG(itmp, atmp );
if( atmp > 0 ) if( atmp > 0 )
track->SetDrillValue( atmp ); track->SetDrill( atmp );
else else
track->SetDrillDefault(); track->SetDrillDefault();
if( itmp > 0 ) if( itmp > 0 )
image->SetDrillValue( itmp ); image->SetDrill( itmp );
else else
image->SetDrillDefault(); image->SetDrillDefault();
} }
...@@ -256,10 +264,7 @@ void SwapData( BOARD_ITEM* aItem, BOARD_ITEM* aImage ) ...@@ -256,10 +264,7 @@ void SwapData( BOARD_ITEM* aItem, BOARD_ITEM* aImage )
break; break;
case PCB_TARGET_T: case PCB_TARGET_T:
EXCHG( ( (PCB_TARGET*) aItem )->m_Pos, ( (PCB_TARGET*) aImage )->m_Pos ); ( (PCB_TARGET*) aItem )->Exchg( (PCB_TARGET*) aImage );
EXCHG( ( (PCB_TARGET*) aItem )->m_Width, ( (PCB_TARGET*) aImage )->m_Width );
EXCHG( ( (PCB_TARGET*) aItem )->m_Size, ( (PCB_TARGET*) aImage )->m_Size );
EXCHG( ( (PCB_TARGET*) aItem )->m_Shape, ( (PCB_TARGET*) aImage )->m_Shape );
break; break;
case PCB_DIMENSION_T: case PCB_DIMENSION_T:
...@@ -268,12 +273,12 @@ void SwapData( BOARD_ITEM* aItem, BOARD_ITEM* aImage ) ...@@ -268,12 +273,12 @@ void SwapData( BOARD_ITEM* aItem, BOARD_ITEM* aImage )
( (DIMENSION*) aItem )->SetText( ( (DIMENSION*) aImage )->GetText() ); ( (DIMENSION*) aItem )->SetText( ( (DIMENSION*) aImage )->GetText() );
( (DIMENSION*) aImage )->SetText( txt ); ( (DIMENSION*) aImage )->SetText( txt );
EXCHG( ( (DIMENSION*) aItem )->m_Width, ( (DIMENSION*) aImage )->m_Width ); EXCHG( ( (DIMENSION*) aItem )->m_Width, ( (DIMENSION*) aImage )->m_Width );
EXCHG( ( (DIMENSION*) aItem )->m_Text->m_Size, ( (DIMENSION*) aImage )->m_Text->m_Size ); EXCHG( ( (DIMENSION*) aItem )->m_Text.m_Size, ( (DIMENSION*) aImage )->m_Text.m_Size );
EXCHG( ( (DIMENSION*) aItem )->m_Text->m_Pos, ( (DIMENSION*) aImage )->m_Text->m_Pos ); EXCHG( ( (DIMENSION*) aItem )->m_Text.m_Pos, ( (DIMENSION*) aImage )->m_Text.m_Pos );
EXCHG( ( (DIMENSION*) aItem )->m_Text->m_Thickness, EXCHG( ( (DIMENSION*) aItem )->m_Text.m_Thickness,
( (DIMENSION*) aImage )->m_Text->m_Thickness ); ( (DIMENSION*) aImage )->m_Text.m_Thickness );
EXCHG( ( (DIMENSION*) aItem )->m_Text->m_Mirror, EXCHG( ( (DIMENSION*) aItem )->m_Text.m_Mirror,
( (DIMENSION*) aImage )->m_Text->m_Mirror ); ( (DIMENSION*) aImage )->m_Text.m_Mirror );
} }
break; break;
......
...@@ -115,25 +115,30 @@ NETCLASS* BOARD_CONNECTED_ITEM::GetNetClass() const ...@@ -115,25 +115,30 @@ NETCLASS* BOARD_CONNECTED_ITEM::GetNetClass() const
// It is important that this be implemented without any sequential searching. // It is important that this be implemented without any sequential searching.
// Simple array lookups should be fine, performance-wise. // Simple array lookups should be fine, performance-wise.
BOARD* board = GetBoard(); BOARD* board = GetBoard();
// DO NOT use wxASSERT, because GetNetClass is called inside an OnPaint event // DO NOT use wxASSERT, because GetNetClass is called inside an OnPaint event
// and a call to wxASSERT can crash the application. // and a call to wxASSERT can crash the application.
if( board == NULL ) // Should not occurs
if( board == NULL ) // Should not occur
{ {
#ifdef __WXDEBUG__ #ifdef __WXDEBUG__
wxLogWarning(wxT("BOARD_CONNECTED_ITEM::GetNetClass():NULL board,type %d"), Type() ); wxLogWarning( wxT("BOARD_CONNECTED_ITEM::GetNetClass():NULL board,type %d"), Type() );
#endif #endif
return NULL; return NULL;
} }
NETCLASS* netclass = NULL; NETCLASS* netclass = NULL;
NETINFO_ITEM* net = board->FindNet( GetNet() ); int netcode = GetNet();
NETINFO_ITEM* net = board->FindNet( netcode );
if( net ) if( net )
{ {
netclass = net->GetNetClass(); netclass = net->GetNetClass();
#ifdef __WXDEBUG__ #ifdef __WXDEBUG__
if( netclass == NULL ) if( netclass == NULL )
{ {
wxLogWarning(wxT("BOARD_CONNECTED_ITEM::GetNetClass():NULL netclass,type %d"), Type()); wxLogWarning( wxT("BOARD_CONNECTED_ITEM::GetNetClass():NULL netclass,type %d"), Type() );
} }
#endif #endif
} }
...@@ -148,7 +153,7 @@ NETCLASS* BOARD_CONNECTED_ITEM::GetNetClass() const ...@@ -148,7 +153,7 @@ NETCLASS* BOARD_CONNECTED_ITEM::GetNetClass() const
* Function GetNetClassName * Function GetNetClassName
* @return the Net Class name of this item * @return the Net Class name of this item
*/ */
wxString BOARD_CONNECTED_ITEM::GetNetClassName( ) const wxString BOARD_CONNECTED_ITEM::GetNetClassName() const
{ {
wxString name; wxString name;
NETCLASS* myclass = GetNetClass(); NETCLASS* myclass = GetNetClass();
......
...@@ -15,7 +15,7 @@ class D_PAD; ...@@ -15,7 +15,7 @@ class D_PAD;
/** /**
* Class BOARD_CONNECTED_ITEM * Class BOARD_CONNECTED_ITEM
* This is a base class derived from BOARD_ITEM for items that can be connected * is a base class derived from BOARD_ITEM for items that can be connected
* and have a net, a netname, a clearance ... * and have a net, a netname, a clearance ...
* mainly: tracks, pads and zones * mainly: tracks, pads and zones
* Handle connection info * Handle connection info
...@@ -89,9 +89,9 @@ public: ...@@ -89,9 +89,9 @@ public:
}; };
/* /**
* class BOARD_ITEM_LIST * Class BOARD_ITEM_LIST
* Handles a collection of BOARD_ITEM elements * is a container for a list of BOARD_ITEMs.
*/ */
class BOARD_ITEM_LIST : public BOARD_ITEM class BOARD_ITEM_LIST : public BOARD_ITEM
{ {
...@@ -204,4 +204,4 @@ public: ...@@ -204,4 +204,4 @@ public:
}; };
#endif /* BOARD_CONNECTED_ITEM_H */ #endif // BOARD_CONNECTED_ITEM_H
...@@ -20,46 +20,45 @@ ...@@ -20,46 +20,45 @@
DIMENSION::DIMENSION( BOARD_ITEM* aParent ) : DIMENSION::DIMENSION( BOARD_ITEM* aParent ) :
BOARD_ITEM( aParent, PCB_DIMENSION_T ) BOARD_ITEM( aParent, PCB_DIMENSION_T ),
m_Text( this )
{ {
m_Layer = DRAW_LAYER; m_Layer = DRAW_LAYER;
m_Width = 50; m_Width = 50;
m_Value = 0; m_Value = 0;
m_Shape = 0; m_Shape = 0;
m_Unit = INCHES; m_Unit = INCHES;
m_Text = new TEXTE_PCB( this );
} }
DIMENSION::~DIMENSION() DIMENSION::~DIMENSION()
{ {
delete m_Text;
} }
void DIMENSION::SetPosition( const wxPoint& aPos ) void DIMENSION::SetPosition( const wxPoint& aPos )
{ {
m_Pos = aPos; m_Pos = aPos;
m_Text->SetPos( aPos ); m_Text.SetPos( aPos );
} }
void DIMENSION::SetText( const wxString& aNewText ) void DIMENSION::SetText( const wxString& aNewText )
{ {
m_Text->SetText( aNewText ); m_Text.SetText( aNewText );
} }
const wxString DIMENSION::GetText() const const wxString DIMENSION::GetText() const
{ {
return m_Text->GetText(); return m_Text.GetText();
} }
void DIMENSION::SetLayer( int aLayer ) void DIMENSION::SetLayer( int aLayer )
{ {
m_Layer = aLayer; m_Layer = aLayer;
m_Text->SetLayer( aLayer); m_Text.SetLayer( aLayer);
} }
...@@ -72,7 +71,7 @@ void DIMENSION::Copy( DIMENSION* source ) ...@@ -72,7 +71,7 @@ void DIMENSION::Copy( DIMENSION* source )
m_Shape = source->m_Shape; m_Shape = source->m_Shape;
m_Unit = source->m_Unit; m_Unit = source->m_Unit;
SetTimeStamp( GetNewTimeStamp() ); SetTimeStamp( GetNewTimeStamp() );
m_Text->Copy( source->m_Text ); m_Text.Copy( &source->m_Text );
m_crossBarOx = source->m_crossBarOx; m_crossBarOx = source->m_crossBarOx;
m_crossBarOy = source->m_crossBarOy; m_crossBarOy = source->m_crossBarOy;
...@@ -105,10 +104,10 @@ void DIMENSION::Copy( DIMENSION* source ) ...@@ -105,10 +104,10 @@ void DIMENSION::Copy( DIMENSION* source )
} }
void DIMENSION::Move(const wxPoint& offset) void DIMENSION::Move( const wxPoint& offset )
{ {
m_Pos += offset; m_Pos += offset;
m_Text->m_Pos += offset; m_Text.m_Pos += offset;
m_crossBarOx += offset.x; m_crossBarOx += offset.x;
m_crossBarOy += offset.y; m_crossBarOy += offset.y;
m_crossBarFx += offset.x; m_crossBarFx += offset.x;
...@@ -140,13 +139,13 @@ void DIMENSION::Move(const wxPoint& offset) ...@@ -140,13 +139,13 @@ void DIMENSION::Move(const wxPoint& offset)
} }
void DIMENSION::Rotate( const wxPoint& aRotCentre, int aAngle ) void DIMENSION::Rotate( const wxPoint& aRotCentre, double aAngle )
{ {
RotatePoint( &m_Pos, aRotCentre, aAngle ); RotatePoint( &m_Pos, aRotCentre, aAngle );
RotatePoint( &m_Text->m_Pos, aRotCentre, aAngle ); RotatePoint( &m_Text.m_Pos, aRotCentre, aAngle );
int newAngle = m_Text->GetOrientation() + aAngle; double newAngle = m_Text.GetOrientation() + aAngle;
if( newAngle >= 3600 ) if( newAngle >= 3600 )
newAngle -= 3600; newAngle -= 3600;
...@@ -154,7 +153,7 @@ void DIMENSION::Rotate( const wxPoint& aRotCentre, int aAngle ) ...@@ -154,7 +153,7 @@ void DIMENSION::Rotate( const wxPoint& aRotCentre, int aAngle )
if( newAngle > 900 && newAngle < 2700 ) if( newAngle > 900 && newAngle < 2700 )
newAngle -= 1800; newAngle -= 1800;
m_Text->SetOrientation( newAngle ); m_Text.SetOrientation( newAngle );
RotatePoint( &m_crossBarOx, &m_crossBarOy, aRotCentre.x, aRotCentre.y, aAngle ); RotatePoint( &m_crossBarOx, &m_crossBarOy, aRotCentre.x, aRotCentre.y, aAngle );
RotatePoint( &m_crossBarFx, &m_crossBarFy, aRotCentre.x, aRotCentre.y, aAngle ); RotatePoint( &m_crossBarFx, &m_crossBarFy, aRotCentre.x, aRotCentre.y, aAngle );
...@@ -180,21 +179,21 @@ void DIMENSION::Flip( const wxPoint& aCentre ) ...@@ -180,21 +179,21 @@ void DIMENSION::Flip( const wxPoint& aCentre )
} }
void DIMENSION::Mirror(const wxPoint& axis_pos) void DIMENSION::Mirror( const wxPoint& axis_pos )
{ {
#define INVERT( pos ) (pos) = axis_pos.y - ( (pos) - axis_pos.y ) #define INVERT( pos ) (pos) = axis_pos.y - ( (pos) - axis_pos.y )
INVERT( m_Pos.y ); INVERT( m_Pos.y );
INVERT( m_Text->m_Pos.y ); INVERT( m_Text.m_Pos.y );
// invert angle // invert angle
int newAngle = m_Text->GetOrientation(); double newAngle = m_Text.GetOrientation();
if( newAngle >= 3600 ) if( newAngle >= 3600 )
newAngle -= 3600; newAngle -= 3600;
if( newAngle > 900 && newAngle < 2700 ) if( newAngle > 900 && newAngle < 2700 )
newAngle -= 1800; newAngle -= 1800;
m_Text->SetOrientation( newAngle ); m_Text.SetOrientation( newAngle );
INVERT( m_crossBarOy ); INVERT( m_crossBarOy );
INVERT( m_crossBarFy ); INVERT( m_crossBarFy );
...@@ -217,25 +216,25 @@ void DIMENSION::AdjustDimensionDetails( bool aDoNotChangeText ) ...@@ -217,25 +216,25 @@ void DIMENSION::AdjustDimensionDetails( bool aDoNotChangeText )
{ {
#define ARROW_SIZE 500 //size of arrows #define ARROW_SIZE 500 //size of arrows
int ii; int ii;
int mesure, deltax, deltay; /* value of the measure on X and Y axes */ int mesure, deltax, deltay; // value of the measure on X and Y axes
int arrow_up_X = 0, arrow_up_Y = 0; /* coordinates of arrow line / */ int arrow_up_X = 0, arrow_up_Y = 0; // coordinates of arrow line /
int arrow_dw_X = 0, arrow_dw_Y = 0; /* coordinates of arrow line \ */ int arrow_dw_X = 0, arrow_dw_Y = 0; // coordinates of arrow line '\'
int hx, hy; /* dimension line interval */ int hx, hy; // dimension line interval
float angle, angle_f; double angle, angle_f;
wxString msg; wxString msg;
/* Init layer : */ // Init layer :
m_Text->SetLayer( GetLayer() ); m_Text.SetLayer( GetLayer() );
/* calculate the size of the dimension (text + line above the text) */ // calculate the size of the dimension (text + line above the text)
ii = m_Text->m_Size.y + ii = m_Text.m_Size.y +
m_Text->GetThickness() + (m_Width * 3); m_Text.GetThickness() + (m_Width * 3);
deltax = m_featureLineDOx - m_featureLineGOx; deltax = m_featureLineDOx - m_featureLineGOx;
deltay = m_featureLineDOy - m_featureLineGOy; deltay = m_featureLineDOy - m_featureLineGOy;
// Calculate dimension value // Calculate dimension value
mesure = wxRound(hypot( (double) deltax, (double) deltay ) ); mesure = wxRound( hypot( (double) deltax, (double) deltay ) );
if( deltax || deltay ) if( deltax || deltay )
angle = atan2( (double) deltay, (double) deltax ); angle = atan2( (double) deltay, (double) deltax );
...@@ -302,11 +301,11 @@ void DIMENSION::AdjustDimensionDetails( bool aDoNotChangeText ) ...@@ -302,11 +301,11 @@ void DIMENSION::AdjustDimensionDetails( bool aDoNotChangeText )
m_featureLineDFx = m_crossBarFx + hx; m_featureLineDFx = m_crossBarFx + hx;
m_featureLineDFy = m_crossBarFy + hy; m_featureLineDFy = m_crossBarFy + hy;
/* Calculate the better text position and orientation: */ // Calculate the better text position and orientation:
m_Pos.x = m_Text->m_Pos.x = (m_crossBarFx + m_featureLineGFx) / 2; m_Pos.x = m_Text.m_Pos.x = (m_crossBarFx + m_featureLineGFx) / 2;
m_Pos.y = m_Text->m_Pos.y = (m_crossBarFy + m_featureLineGFy) / 2; m_Pos.y = m_Text.m_Pos.y = (m_crossBarFy + m_featureLineGFy) / 2;
int newAngle = -(int) (angle * 1800 / M_PI); double newAngle = -(angle * 1800 / M_PI);
if( newAngle < 0 ) if( newAngle < 0 )
newAngle += 3600; newAngle += 3600;
...@@ -316,7 +315,7 @@ void DIMENSION::AdjustDimensionDetails( bool aDoNotChangeText ) ...@@ -316,7 +315,7 @@ void DIMENSION::AdjustDimensionDetails( bool aDoNotChangeText )
if( newAngle > 900 && newAngle < 2700 ) if( newAngle > 900 && newAngle < 2700 )
newAngle -= 1800; newAngle -= 1800;
m_Text->SetOrientation( newAngle ); m_Text.SetOrientation( newAngle );
if( !aDoNotChangeText ) if( !aDoNotChangeText )
{ {
...@@ -334,7 +333,7 @@ void DIMENSION::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int mode_color, const wxP ...@@ -334,7 +333,7 @@ void DIMENSION::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int mode_color, const wxP
ox = -offset.x; ox = -offset.x;
oy = -offset.y; oy = -offset.y;
m_Text->Draw( panel, DC, mode_color, offset ); m_Text.Draw( panel, DC, mode_color, offset );
BOARD * brd = GetBoard( ); BOARD * brd = GetBoard( );
...@@ -417,7 +416,7 @@ void DIMENSION::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int mode_color, const wxP ...@@ -417,7 +416,7 @@ void DIMENSION::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int mode_color, const wxP
void DIMENSION::DisplayInfo( EDA_DRAW_FRAME* frame ) void DIMENSION::DisplayInfo( EDA_DRAW_FRAME* frame )
{ {
// for now, display only the text within the DIMENSION using class TEXTE_PCB. // for now, display only the text within the DIMENSION using class TEXTE_PCB.
m_Text->DisplayInfo( frame ); m_Text.DisplayInfo( frame );
} }
...@@ -426,14 +425,14 @@ bool DIMENSION::HitTest( const wxPoint& aPoint ) ...@@ -426,14 +425,14 @@ bool DIMENSION::HitTest( const wxPoint& aPoint )
int ux0, uy0; int ux0, uy0;
int dx, dy, spot_cX, spot_cY; int dx, dy, spot_cX, spot_cY;
if( m_Text && m_Text->TextHitTest( aPoint ) ) if( m_Text.TextHitTest( aPoint ) )
return true; return true;
/* Locate SEGMENTS? */ // Locate SEGMENTS?
ux0 = m_crossBarOx; ux0 = m_crossBarOx;
uy0 = m_crossBarOy; uy0 = m_crossBarOy;
/* Recalculate coordinates with ux0, uy0 = origin. */ // Recalculate coordinates with ux0, uy0 = origin.
dx = m_crossBarFx - ux0; dx = m_crossBarFx - ux0;
dy = m_crossBarFy - uy0; dy = m_crossBarFy - uy0;
...@@ -533,7 +532,7 @@ EDA_RECT DIMENSION::GetBoundingBox() const ...@@ -533,7 +532,7 @@ EDA_RECT DIMENSION::GetBoundingBox() const
EDA_RECT bBox; EDA_RECT bBox;
int xmin, xmax, ymin, ymax; int xmin, xmax, ymin, ymax;
bBox = m_Text->GetTextBox( -1 ); bBox = m_Text.GetTextBox( -1 );
xmin = bBox.GetX(); xmin = bBox.GetX();
xmax = bBox.GetRight(); xmax = bBox.GetRight();
ymin = bBox.GetY(); ymin = bBox.GetY();
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
* @brief DIMENSION class definition. * @brief DIMENSION class definition.
*/ */
#ifndef DIMENSION_H #ifndef DIMENSION_H_
#define DIMENSION_H #define DIMENSION_H_
#include "class_board_item.h" #include "class_board_item.h"
...@@ -21,10 +21,10 @@ public: ...@@ -21,10 +21,10 @@ public:
int m_Width; int m_Width;
wxPoint m_Pos; wxPoint m_Pos;
int m_Shape; int m_Shape;
int m_Unit; /* 0 = inches, 1 = mm */ int m_Unit; /// 0 = inches, 1 = mm
int m_Value; /* value of PCB dimensions. */ int m_Value; /// value of PCB dimensions.
TEXTE_PCB* m_Text; TEXTE_PCB m_Text;
int m_crossBarOx, m_crossBarOy, m_crossBarFx, m_crossBarFy; int m_crossBarOx, m_crossBarOy, m_crossBarFx, m_crossBarFy;
int m_featureLineGOx, m_featureLineGOy, m_featureLineGFx, m_featureLineGFy; int m_featureLineGOx, m_featureLineGOy, m_featureLineGFx, m_featureLineGFy;
int m_featureLineDOx, m_featureLineDOy, m_featureLineDFx, m_featureLineDFy; int m_featureLineDOx, m_featureLineDOy, m_featureLineDFx, m_featureLineDFy;
...@@ -43,7 +43,7 @@ public: ...@@ -43,7 +43,7 @@ public:
void SetTextSize( const wxSize& aTextSize ) void SetTextSize( const wxSize& aTextSize )
{ {
m_Text->SetSize( aTextSize ); m_Text.SetSize( aTextSize );
} }
/** /**
...@@ -53,6 +53,12 @@ public: ...@@ -53,6 +53,12 @@ public:
*/ */
void SetLayer( int aLayer ); void SetLayer( int aLayer );
void SetShape( int aShape ) { m_Shape = aShape; }
int GetShape() const { return m_Shape; }
int GetWidth() const { return m_Width; }
void SetWidth( int aWidth ) { m_Width = aWidth; }
/** /**
* Function AdjustDimensionDetails * Function AdjustDimensionDetails
* Calculate coordinates of segments used to draw the dimension. * Calculate coordinates of segments used to draw the dimension.
...@@ -90,7 +96,7 @@ public: ...@@ -90,7 +96,7 @@ public:
* @param aRotCentre - the rotation point. * @param aRotCentre - the rotation point.
* @param aAngle - the rotation angle in 0.1 degree. * @param aAngle - the rotation angle in 0.1 degree.
*/ */
virtual void Rotate( const wxPoint& aRotCentre, int aAngle ); virtual void Rotate( const wxPoint& aRotCentre, double aAngle );
/** /**
* Function Flip * Function Flip
...@@ -151,4 +157,4 @@ public: ...@@ -151,4 +157,4 @@ public:
virtual BITMAP_DEF GetMenuImage() const { return add_dimension_xpm; } virtual BITMAP_DEF GetMenuImage() const { return add_dimension_xpm; }
}; };
#endif // #define DIMENSION_H #endif // DIMENSION_H_
...@@ -31,31 +31,40 @@ DRAWSEGMENT::DRAWSEGMENT( BOARD_ITEM* aParent, KICAD_T idtype ) : ...@@ -31,31 +31,40 @@ DRAWSEGMENT::DRAWSEGMENT( BOARD_ITEM* aParent, KICAD_T idtype ) :
} }
DRAWSEGMENT:: ~DRAWSEGMENT() DRAWSEGMENT::~DRAWSEGMENT()
{ {
} }
const DRAWSEGMENT& DRAWSEGMENT::operator = ( const DRAWSEGMENT& rhs )
{
// skip the linked list stuff, and parent
m_Type = rhs.m_Type;
m_Layer = rhs.m_Layer;
m_Width = rhs.m_Width;
m_Start = rhs.m_Start;
m_End = rhs.m_End;
m_Shape = rhs.m_Shape;
m_Angle = rhs.m_Angle;
m_TimeStamp = rhs.m_TimeStamp;
m_BezierC1 = rhs.m_BezierC1;
m_BezierC2 = rhs.m_BezierC1;
m_BezierPoints = rhs.m_BezierPoints;
return *this;
}
void DRAWSEGMENT::Copy( DRAWSEGMENT* source ) void DRAWSEGMENT::Copy( DRAWSEGMENT* source )
{ {
if( source == NULL ) if( source == NULL ) // who would do this?
return; return;
m_Type = source->m_Type; *this = *source; // operator = ()
m_Layer = source->m_Layer;
m_Width = source->m_Width;
m_Start = source->m_Start;
m_End = source->m_End;
m_Shape = source->m_Shape;
m_Angle = source->m_Angle;
SetTimeStamp( source->m_TimeStamp );
m_BezierC1 = source->m_BezierC1;
m_BezierC2 = source->m_BezierC1;
m_BezierPoints = source->m_BezierPoints;
} }
void DRAWSEGMENT::Rotate( const wxPoint& aRotCentre, double aAngle )
void DRAWSEGMENT::Rotate( const wxPoint& aRotCentre, int aAngle )
{ {
RotatePoint( &m_Start, aRotCentre, aAngle ); RotatePoint( &m_Start, aRotCentre, aAngle );
RotatePoint( &m_End, aRotCentre, aAngle ); RotatePoint( &m_End, aRotCentre, aAngle );
...@@ -74,7 +83,26 @@ void DRAWSEGMENT::Flip( const wxPoint& aCentre ) ...@@ -74,7 +83,26 @@ void DRAWSEGMENT::Flip( const wxPoint& aCentre )
} }
wxPoint DRAWSEGMENT::GetStart() const const wxPoint DRAWSEGMENT::GetArcEnd() const
{
wxPoint endPoint; // start of arc
switch( m_Shape )
{
case S_ARC:
// rotate the starting point of the arc, given by m_End, through the
// angle m_Angle to get the ending point of the arc.
// m_Start is the arc centre
endPoint = m_End; // m_End = start point of arc
RotatePoint( &endPoint, m_Start, -m_Angle );
}
return endPoint; // after rotation, the end of the arc.
}
/* use GetArcStart() now
const wxPoint DRAWSEGMENT::GetStart() const
{ {
switch( m_Shape ) switch( m_Shape )
{ {
...@@ -88,7 +116,7 @@ wxPoint DRAWSEGMENT::GetStart() const ...@@ -88,7 +116,7 @@ wxPoint DRAWSEGMENT::GetStart() const
} }
wxPoint DRAWSEGMENT::GetEnd() const const wxPoint DRAWSEGMENT::GetEnd() const
{ {
wxPoint endPoint; // start of arc wxPoint endPoint; // start of arc
...@@ -108,6 +136,7 @@ wxPoint DRAWSEGMENT::GetEnd() const ...@@ -108,6 +136,7 @@ wxPoint DRAWSEGMENT::GetEnd() const
return m_End; return m_End;
} }
} }
*/
void DRAWSEGMENT::SetAngle( double aAngle ) void DRAWSEGMENT::SetAngle( double aAngle )
......
...@@ -18,35 +18,33 @@ class MODULE; ...@@ -18,35 +18,33 @@ class MODULE;
class DRAWSEGMENT : public BOARD_ITEM class DRAWSEGMENT : public BOARD_ITEM
{ {
public: protected:
int m_Width; // thickness of lines ... int m_Width; ///< thickness of lines ...
wxPoint m_Start; // Line start point or Circle and Arc center wxPoint m_Start; ///< Line start point or Circle and Arc center
wxPoint m_End; // Line end point or circle and arc start point wxPoint m_End; ///< Line end point or circle and arc start point
int m_Shape; // Shape: line, Circle, Arc int m_Shape; ///< Shape: line, Circle, Arc
int m_Type; // Used in complex associations ( Dimensions.. ) int m_Type; ///< Used in complex associations ( Dimensions.. )
int m_Angle; // Used only for Arcs: Arc angle in 1/10 deg double m_Angle; ///< Used only for Arcs: Arc angle in 1/10 deg
wxPoint m_BezierC1; // Bezier Control Point 1 wxPoint m_BezierC1; ///< Bezier Control Point 1
wxPoint m_BezierC2; // Bezier Control Point 1 wxPoint m_BezierC2; ///< Bezier Control Point 1
protected:
std::vector<wxPoint> m_BezierPoints; std::vector<wxPoint> m_BezierPoints;
std::vector<wxPoint> m_PolyPoints; std::vector<wxPoint> m_PolyPoints;
public: public:
DRAWSEGMENT( BOARD_ITEM* aParent, KICAD_T idtype = PCB_LINE_T ); DRAWSEGMENT( BOARD_ITEM* aParent = NULL, KICAD_T idtype = PCB_LINE_T );
~DRAWSEGMENT(); ~DRAWSEGMENT();
/// skip the linked list stuff, and parent
const DRAWSEGMENT& operator = ( const DRAWSEGMENT& rhs );
DRAWSEGMENT* Next() const { return (DRAWSEGMENT*) Pnext; } DRAWSEGMENT* Next() const { return (DRAWSEGMENT*) Pnext; }
DRAWSEGMENT* Back() const { return (DRAWSEGMENT*) Pback; } DRAWSEGMENT* Back() const { return (DRAWSEGMENT*) Pback; }
void SetWidth( int aWidth ) { m_Width = aWidth; } void SetWidth( int aWidth ) { m_Width = aWidth; }
int GetWidth() const { return m_Width; } int GetWidth() const { return m_Width; }
void SetStart( const wxPoint& aStart ) { m_Start = aStart; }
void SetEnd( const wxPoint& aEnd ) { m_End = aEnd; }
/** /**
* Function SetAngle * Function SetAngle
* sets the angle for arcs, and normalizes it within the range 0 - 360 degrees. * sets the angle for arcs, and normalizes it within the range 0 - 360 degrees.
...@@ -56,37 +54,44 @@ public: ...@@ -56,37 +54,44 @@ public:
double GetAngle() const { return m_Angle; } double GetAngle() const { return m_Angle; }
void SetType( int aType ) { m_Type = aType; } void SetType( int aType ) { m_Type = aType; }
int GetType() const { return m_Type; }
void SetShape( int aShape ) { m_Shape = aShape; } void SetShape( int aShape ) { m_Shape = aShape; }
int GetShape() const { return m_Shape; } int GetShape() const { return m_Shape; }
void SetBezControl1( const wxPoint& aPoint ) { m_BezierC1 = aPoint; } void SetBezControl1( const wxPoint& aPoint ) { m_BezierC1 = aPoint; }
void SetBezControl2( const wxPoint& aPoint ) { m_BezierC2 = aPoint; } const wxPoint& GetBezControl1() const { return m_BezierC1; }
/** void SetBezControl2( const wxPoint& aPoint ) { m_BezierC2 = aPoint; }
* Function GetPosition const wxPoint& GetBezControl2() const { return m_BezierC2; }
* returns the position of this object.
* Required by pure virtual BOARD_ITEM::GetPosition()
* @return const wxPoint - The position of this object.
*/
const wxPoint GetPosition() const
{
return m_Start;
}
void SetPosition( const wxPoint& aPos ) { m_Start = aPos; } void SetPosition( const wxPoint& aPos ) { m_Start = aPos; } // override
const wxPoint GetPosition() const { return m_Start; } // override
/** /**
* Function GetStart * Function GetStart
* returns the starting point of the graphic * returns the starting point of the graphic
*/ */
wxPoint GetStart() const; const wxPoint& GetStart() const { return m_Start; }
void SetStart( const wxPoint& aStart ) { m_Start = aStart; }
void SetStartY( int y ) { m_Start.y = y; }
void SetStartX( int x ) { m_Start.x = x; }
/** /**
* Function GetEnd * Function GetEnd
* returns the ending point of the graphic * returns the ending point of the graphic
*/ */
wxPoint GetEnd() const; const wxPoint& GetEnd() const { return m_End; }
void SetEnd( const wxPoint& aEnd ) { m_End = aEnd; }
void SetEndY( int y ) { m_End.y = y; }
void SetEndX( int x ) { m_End.x = x; }
// Arc attributes are read only, since they are "calculated" from
// m_Start, m_End, and m_Angle. No Set...() functions.
const wxPoint& GetCenter() const { return m_Start; }
const wxPoint& GetArcStart() const { return m_End; }
const wxPoint GetArcEnd() const;
/** /**
* Function GetRadius * Function GetRadius
...@@ -132,7 +137,6 @@ public: ...@@ -132,7 +137,6 @@ public:
void Copy( DRAWSEGMENT* source ); void Copy( DRAWSEGMENT* source );
void Draw( EDA_DRAW_PANEL* panel, wxDC* DC, void Draw( EDA_DRAW_PANEL* panel, wxDC* DC,
int aDrawMode, const wxPoint& aOffset = ZeroOffset ); int aDrawMode, const wxPoint& aOffset = ZeroOffset );
...@@ -145,7 +149,6 @@ public: ...@@ -145,7 +149,6 @@ public:
*/ */
virtual void DisplayInfo( EDA_DRAW_FRAME* frame ); virtual void DisplayInfo( EDA_DRAW_FRAME* frame );
/** /**
* Function GetBoundingBox * Function GetBoundingBox
* returns the orthogonal, bounding box of this object for display purposes. * returns the orthogonal, bounding box of this object for display purposes.
...@@ -155,7 +158,6 @@ public: ...@@ -155,7 +158,6 @@ public:
*/ */
virtual EDA_RECT GetBoundingBox() const; virtual EDA_RECT GetBoundingBox() const;
/** /**
* Function HitTest * Function HitTest
* tests if the given wxPoint is within the bounds of this object. * tests if the given wxPoint is within the bounds of this object.
...@@ -183,7 +185,6 @@ public: ...@@ -183,7 +185,6 @@ public:
return wxT( "DRAWSEGMENT" ); return wxT( "DRAWSEGMENT" );
} }
/** /**
* Function GetLength * Function GetLength
* returns the length of the track using the hypotenuse calculation. * returns the length of the track using the hypotenuse calculation.
...@@ -196,7 +197,6 @@ public: ...@@ -196,7 +197,6 @@ public:
return hypot( double( delta.x ), double( delta.y ) ); return hypot( double( delta.x ), double( delta.y ) );
} }
/** /**
* Function Move * Function Move
* move this object. * move this object.
...@@ -208,14 +208,13 @@ public: ...@@ -208,14 +208,13 @@ public:
m_End += aMoveVector; m_End += aMoveVector;
} }
/** /**
* Function Rotate * Function Rotate
* Rotate this object. * Rotate this object.
* @param aRotCentre - the rotation point. * @param aRotCentre - the rotation point.
* @param aAngle - the rotation angle in 0.1 degree. * @param aAngle - the rotation angle in 0.1 degree.
*/ */
virtual void Rotate( const wxPoint& aRotCentre, int aAngle ); virtual void Rotate( const wxPoint& aRotCentre, double aAngle );
/** /**
* Function Flip * Function Flip
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
* @brief EDGE_MODULE class definition. * @brief EDGE_MODULE class definition.
*/ */
#ifndef _CLASS_EDGE_MOD_H_ #ifndef CLASS_EDGE_MOD_H_
#define _CLASS_EDGE_MOD_H_ #define CLASS_EDGE_MOD_H_
#include "class_drawsegment.h" #include "class_drawsegment.h"
...@@ -31,6 +31,12 @@ public: ...@@ -31,6 +31,12 @@ public:
void Copy( EDGE_MODULE* source ); // copy structure void Copy( EDGE_MODULE* source ); // copy structure
void SetStart0( const wxPoint& aPoint ) { m_Start0 = aPoint; }
const wxPoint& GetStart0() const { return m_Start0; }
void SetEnd0( const wxPoint& aPoint ) { m_End0 = aPoint; }
const wxPoint& GetEnd0() const { return m_End0; }
/** /**
* 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.
...@@ -88,4 +94,4 @@ public: ...@@ -88,4 +94,4 @@ public:
#endif #endif
}; };
#endif // _CLASS_EDGE_MOD_H_ #endif // CLASS_EDGE_MOD_H_
...@@ -80,25 +80,12 @@ void MARKER_PCB::DisplayInfo( EDA_DRAW_FRAME* frame ) ...@@ -80,25 +80,12 @@ void MARKER_PCB::DisplayInfo( EDA_DRAW_FRAME* frame )
} }
/** void MARKER_PCB::Rotate(const wxPoint& aRotCentre, double aAngle)
* Function Rotate
* Rotate this object.
* @param aRotCentre - the rotation point.
* @param aAngle - the rotation angle in 0.1 degree.
*/
void MARKER_PCB::Rotate(const wxPoint& aRotCentre, int aAngle)
{ {
RotatePoint( &m_Pos, aRotCentre, aAngle ); RotatePoint( &m_Pos, aRotCentre, aAngle );
} }
/**
* Function Flip
* Flip this object, i.e. change the board side for this object
* this function has not really sense for a marker.
* It moves just the marker to keep its position on board, when the board is flipped
* @param aCentre - the rotation point.
*/
void MARKER_PCB::Flip(const wxPoint& aCentre ) void MARKER_PCB::Flip(const wxPoint& aCentre )
{ {
m_Pos.y = aCentre.y - (m_Pos.y - aCentre.y); m_Pos.y = aCentre.y - (m_Pos.y - aCentre.y);
......
...@@ -59,7 +59,7 @@ public: ...@@ -59,7 +59,7 @@ public:
* @param aRotCentre - the rotation point. * @param aRotCentre - the rotation point.
* @param aAngle - the rotation angle in 0.1 degree. * @param aAngle - the rotation angle in 0.1 degree.
*/ */
virtual void Rotate( const wxPoint& aRotCentre, int aAngle ); virtual void Rotate( const wxPoint& aRotCentre, double aAngle );
/** /**
* Function Flip * Function Flip
......
...@@ -43,6 +43,15 @@ PCB_TARGET::~PCB_TARGET() ...@@ -43,6 +43,15 @@ PCB_TARGET::~PCB_TARGET()
} }
void PCB_TARGET::Exchg( PCB_TARGET* source )
{
EXCHG( m_Pos, source->m_Pos );
EXCHG( m_Width, source->m_Width );
EXCHG( m_Size, source->m_Size );
EXCHG( m_Shape, source->m_Shape );
}
void PCB_TARGET::Copy( PCB_TARGET* source ) void PCB_TARGET::Copy( PCB_TARGET* source )
{ {
m_Layer = source->m_Layer; m_Layer = source->m_Layer;
...@@ -143,12 +152,6 @@ bool PCB_TARGET::HitTest( const wxPoint& refPos ) ...@@ -143,12 +152,6 @@ bool PCB_TARGET::HitTest( const wxPoint& refPos )
} }
/**
* Function HitTest (overlayed)
* tests if the given EDA_RECT intersect this object.
* @param refArea : the given EDA_RECT
* @return bool - true if a hit, else false
*/
bool PCB_TARGET::HitTest( EDA_RECT& refArea ) bool PCB_TARGET::HitTest( EDA_RECT& refArea )
{ {
if( refArea.Contains( m_Pos ) ) if( refArea.Contains( m_Pos ) )
...@@ -158,23 +161,12 @@ bool PCB_TARGET::HitTest( EDA_RECT& refArea ) ...@@ -158,23 +161,12 @@ bool PCB_TARGET::HitTest( EDA_RECT& refArea )
} }
/** void PCB_TARGET::Rotate(const wxPoint& aRotCentre, double aAngle)
* Function Rotate
* Rotate this object.
* @param aRotCentre - the rotation point.
* @param aAngle - the rotation angle in 0.1 degree.
*/
void PCB_TARGET::Rotate(const wxPoint& aRotCentre, int aAngle)
{ {
RotatePoint( &m_Pos, aRotCentre, aAngle ); RotatePoint( &m_Pos, aRotCentre, aAngle );
} }
/**
* Function Flip
* Flip this object, i.e. change the board side for this object
* @param aCentre - the rotation point.
*/
void PCB_TARGET::Flip(const wxPoint& aCentre ) void PCB_TARGET::Flip(const wxPoint& aCentre )
{ {
m_Pos.y = aCentre.y - ( m_Pos.y - aCentre.y ); m_Pos.y = aCentre.y - ( m_Pos.y - aCentre.y );
......
...@@ -17,11 +17,10 @@ class EDA_DRAW_PANEL; ...@@ -17,11 +17,10 @@ class EDA_DRAW_PANEL;
class PCB_TARGET : public BOARD_ITEM class PCB_TARGET : public BOARD_ITEM
{ {
public:
int m_Width;
wxPoint m_Pos;
int m_Shape; // bit 0 : 0 = draw +, 1 = draw X int m_Shape; // bit 0 : 0 = draw +, 1 = draw X
int m_Size; int m_Size;
int m_Width;
wxPoint m_Pos;
public: public:
PCB_TARGET( BOARD_ITEM* aParent ); PCB_TARGET( BOARD_ITEM* aParent );
...@@ -33,12 +32,23 @@ public: ...@@ -33,12 +32,23 @@ public:
PCB_TARGET* Next() const { return (PCB_TARGET*) Pnext; } PCB_TARGET* Next() const { return (PCB_TARGET*) Pnext; }
PCB_TARGET* Back() const { return (PCB_TARGET*) Pnext; } PCB_TARGET* Back() const { return (PCB_TARGET*) Pnext; }
const wxPoint GetPosition() const void SetPosition( const wxPoint& aPos ) { m_Pos = aPos; } // override
{ const wxPoint GetPosition() const { return m_Pos; } // override
return m_Pos;
}
void SetPosition( const wxPoint& aPos ) { m_Pos = aPos; } void SetShape( int aShape ) { m_Shape = aShape; }
int GetShape() const { return m_Shape; }
void SetSize( int aSize ) { m_Size = aSize; }
int GetSize() const { return m_Size; }
void SetWidth( int aWidth ) { m_Width = aWidth; }
int GetWidth() const { return m_Width; }
/**
* Function Exchg
* swaps data with another PCB_TARGET for use by undo-redo.
*/
void Exchg( PCB_TARGET* aTarget );
/** /**
* Function Move * Function Move
...@@ -56,7 +66,7 @@ public: ...@@ -56,7 +66,7 @@ public:
* @param aRotCentre - the rotation point. * @param aRotCentre - the rotation point.
* @param aAngle - the rotation angle in 0.1 degree. * @param aAngle - the rotation angle in 0.1 degree.
*/ */
virtual void Rotate( const wxPoint& aRotCentre, int aAngle ); virtual void Rotate( const wxPoint& aRotCentre, double aAngle );
/** /**
* Function Flip * Function Flip
...@@ -80,7 +90,6 @@ public: ...@@ -80,7 +90,6 @@ public:
void Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int aDrawMode, void Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int aDrawMode,
const wxPoint& offset = ZeroOffset ); const wxPoint& offset = ZeroOffset );
/** /**
* Function HitTest * Function HitTest
* tests if the given wxPoint is within the bounds of this object. * tests if the given wxPoint is within the bounds of this object.
......
...@@ -43,7 +43,7 @@ class MODULE : public BOARD_ITEM ...@@ -43,7 +43,7 @@ class MODULE : public BOARD_ITEM
{ {
public: public:
int m_Orient; // orientation in 0.1 degrees double m_Orient; // orientation in 0.1 degrees
wxPoint m_Pos; // Real coord on board wxPoint m_Pos; // Real coord on board
DLIST<D_PAD> m_Pads; /* Pad list (linked list) */ DLIST<D_PAD> m_Pads; /* Pad list (linked list) */
DLIST<BOARD_ITEM> m_Drawings; /* Graphic items list (linked list) */ DLIST<BOARD_ITEM> m_Drawings; /* Graphic items list (linked list) */
...@@ -142,15 +142,11 @@ public: ...@@ -142,15 +142,11 @@ public:
*/ */
EDA_RECT GetBoundingBox() const; EDA_RECT GetBoundingBox() const;
const wxPoint GetPosition() const // overload
{
return m_Pos;
}
void SetPosition( const wxPoint& aPos ); // overload void SetPosition( const wxPoint& aPos ); // overload
const wxPoint GetPosition() const { return m_Pos; } // overload
void SetOrientation( int newangle ); void SetOrientation( double newangle );
int GetOrientation() const { return m_Orient; } double GetOrientation() const { return m_Orient; }
const wxString& GetLibRef() const { return m_LibRef; } const wxString& GetLibRef() const { return m_LibRef; }
void SetLibRef( const wxString& aLibRef ) { m_LibRef = aLibRef; } void SetLibRef( const wxString& aLibRef ) { m_LibRef = aLibRef; }
...@@ -192,7 +188,7 @@ public: ...@@ -192,7 +188,7 @@ public:
* @param aRotCentre - the rotation point. * @param aRotCentre - the rotation point.
* @param aAngle - the rotation angle in 0.1 degree. * @param aAngle - the rotation angle in 0.1 degree.
*/ */
virtual void Rotate( const wxPoint& aRotCentre, int aAngle ); virtual void Rotate( const wxPoint& aRotCentre, double aAngle );
/** /**
* Function Flip * Function Flip
......
...@@ -127,25 +127,14 @@ int ChangeSideMaskLayer( int aMask ) ...@@ -127,25 +127,14 @@ int ChangeSideMaskLayer( int aMask )
} }
/** void MODULE::Move( const wxPoint& aMoveVector )
* Function Move (virtual)
* move this object.
* @param aMoveVector - the move vector for this object.
*/
void MODULE::Move(const wxPoint& aMoveVector)
{ {
wxPoint newpos = m_Pos + aMoveVector; wxPoint newpos = m_Pos + aMoveVector;
SetPosition( newpos ); SetPosition( newpos );
} }
/** void MODULE::Rotate( const wxPoint& aRotCentre, double aAngle )
* Function Rotate
* Rotate this object.
* @param aRotCentre - the rotation point.
* @param aAngle - the rotation angle in 0.1 degree.
*/
void MODULE::Rotate(const wxPoint& aRotCentre, int aAngle)
{ {
wxPoint newpos = m_Pos; wxPoint newpos = m_Pos;
RotatePoint( &newpos, aRotCentre, aAngle ); RotatePoint( &newpos, aRotCentre, aAngle );
...@@ -154,48 +143,42 @@ void MODULE::Rotate(const wxPoint& aRotCentre, int aAngle) ...@@ -154,48 +143,42 @@ void MODULE::Rotate(const wxPoint& aRotCentre, int aAngle)
} }
/**
* Function Flip
* Flip this object, i.e. change the board side for this object
* @param aCentre - the rotation point.
*/
void MODULE::Flip( const wxPoint& aCentre ) void MODULE::Flip( const wxPoint& aCentre )
{ {
D_PAD* pt_pad;
TEXTE_MODULE* pt_texte; TEXTE_MODULE* pt_texte;
EDGE_MODULE* pt_edgmod;
EDA_ITEM* PtStruct;
// Move module to its final position: // Move module to its final position:
wxPoint finalPos = m_Pos; wxPoint finalPos = m_Pos;
finalPos.y = aCentre.y - ( finalPos.y - aCentre.y ); /// Mirror the Y position finalPos.y = aCentre.y - ( finalPos.y - aCentre.y ); /// Mirror the Y position
SetPosition(finalPos);
/* Flip layer */ SetPosition( finalPos );
// Flip layer
SetLayer( ChangeSideNumLayer( GetLayer() ) ); SetLayer( ChangeSideNumLayer( GetLayer() ) );
/* Reverse mirror orientation. */ // Reverse mirror orientation.
NEGATE( m_Orient ); NEGATE( m_Orient );
NORMALIZE_ANGLE_POS( m_Orient ); NORMALIZE_ANGLE_POS( m_Orient );
/* Mirror inversion layers pads. */ // Mirror inversion layers pads.
pt_pad = m_Pads; for( D_PAD* pad = m_Pads; pad; pad = pad->Next() )
for( ; pt_pad != NULL; pt_pad = pt_pad->Next() )
{ {
pt_pad->m_Pos.y -= m_Pos.y; pad->m_Pos.y -= m_Pos.y;
pt_pad->m_Pos.y = -pt_pad->m_Pos.y; pad->m_Pos.y = -pad->m_Pos.y;
pt_pad->m_Pos.y += m_Pos.y; pad->m_Pos.y += m_Pos.y;
NEGATE( pt_pad->m_Pos0.y );
NEGATE( pt_pad->m_Offset.y ); NEGATE( pad->m_Pos0.y );
NEGATE( pt_pad->m_DeltaSize.y ); NEGATE( pad->m_Offset.y );
NEGATE_AND_NORMALIZE_ANGLE_POS( pt_pad->m_Orient ); NEGATE( pad->m_DeltaSize.y );
/* flip pads layers*/ NEGATE_AND_NORMALIZE_ANGLE_POS( pad->m_Orient );
pt_pad->m_layerMask = ChangeSideMaskLayer( pt_pad->m_layerMask );
// flip pads layers
pad->m_layerMask = ChangeSideMaskLayer( pad->m_layerMask );
} }
/* Mirror reference. */ // Mirror reference.
pt_texte = m_Reference; pt_texte = m_Reference;
pt_texte->m_Pos.y -= m_Pos.y; pt_texte->m_Pos.y -= m_Pos.y;
pt_texte->m_Pos.y = -pt_texte->m_Pos.y; pt_texte->m_Pos.y = -pt_texte->m_Pos.y;
...@@ -216,7 +199,7 @@ void MODULE::Flip( const wxPoint& aCentre ) ...@@ -216,7 +199,7 @@ void MODULE::Flip( const wxPoint& aCentre )
|| (GetLayer() == ADHESIVE_N_BACK) || (GetLayer() == LAYER_N_BACK) ) || (GetLayer() == ADHESIVE_N_BACK) || (GetLayer() == LAYER_N_BACK) )
pt_texte->m_Mirror = true; pt_texte->m_Mirror = true;
/* Mirror value. */ // Mirror value.
pt_texte = m_Value; pt_texte = m_Value;
pt_texte->m_Pos.y -= m_Pos.y; pt_texte->m_Pos.y -= m_Pos.y;
NEGATE( pt_texte->m_Pos.y ); NEGATE( pt_texte->m_Pos.y );
...@@ -237,33 +220,42 @@ void MODULE::Flip( const wxPoint& aCentre ) ...@@ -237,33 +220,42 @@ void MODULE::Flip( const wxPoint& aCentre )
|| (GetLayer() == ADHESIVE_N_BACK) || (GetLayer() == LAYER_N_BACK) ) || (GetLayer() == ADHESIVE_N_BACK) || (GetLayer() == LAYER_N_BACK) )
pt_texte->m_Mirror = true; pt_texte->m_Mirror = true;
/* Reverse mirror footprints. */ // Reverse mirror module graphics and texts.
PtStruct = m_Drawings; for( EDA_ITEM* item = m_Drawings; item; item = item->Next() )
for( ; PtStruct != NULL; PtStruct = PtStruct->Next() )
{ {
switch( PtStruct->Type() ) switch( item->Type() )
{ {
case PCB_MODULE_EDGE_T: case PCB_MODULE_EDGE_T:
pt_edgmod = (EDGE_MODULE*) PtStruct;
pt_edgmod->m_Start.y -= m_Pos.y;
pt_edgmod->m_Start.y = -pt_edgmod->m_Start.y;
pt_edgmod->m_Start.y += m_Pos.y;
pt_edgmod->m_End.y -= m_Pos.y;
pt_edgmod->m_End.y = -pt_edgmod->m_End.y;
pt_edgmod->m_End.y += m_Pos.y;
NEGATE( pt_edgmod->m_Start0.y );
NEGATE( pt_edgmod->m_End0.y );
if( pt_edgmod->m_Shape == S_ARC )
{ {
NEGATE(pt_edgmod->m_Angle); EDGE_MODULE* em = (EDGE_MODULE*) item;
wxPoint s = em->GetStart();
s.y -= m_Pos.y;
s.y = -s.y;
s.y += m_Pos.y;
em->SetStart( s );
wxPoint e = em->GetEnd();
e.y -= m_Pos.y;
e.y = -e.y;
e.y += m_Pos.y;
em->SetEnd( e );
NEGATE( em->m_Start0.y );
NEGATE( em->m_End0.y );
if( em->GetShape() == S_ARC )
{
em->SetAngle( -em->GetAngle() );
} }
pt_edgmod->SetLayer( ChangeSideNumLayer( pt_edgmod->GetLayer() ) ); em->SetLayer( ChangeSideNumLayer( em->GetLayer() ) );
}
break; break;
case PCB_MODULE_TEXT_T: case PCB_MODULE_TEXT_T:
/* Reverse mirror position and mirror. */ // Reverse mirror position and mirror.
pt_texte = (TEXTE_MODULE*) PtStruct; pt_texte = (TEXTE_MODULE*) item;
pt_texte->m_Pos.y -= m_Pos.y; pt_texte->m_Pos.y -= m_Pos.y;
pt_texte->m_Pos.y = -pt_texte->m_Pos.y; pt_texte->m_Pos.y = -pt_texte->m_Pos.y;
pt_texte->m_Pos.y += m_Pos.y; pt_texte->m_Pos.y += m_Pos.y;
...@@ -298,6 +290,7 @@ void MODULE::Flip( const wxPoint& aCentre ) ...@@ -298,6 +290,7 @@ void MODULE::Flip( const wxPoint& aCentre )
CalculateBoundingBox(); CalculateBoundingBox();
} }
void MODULE::SetPosition( const wxPoint& newpos ) void MODULE::SetPosition( const wxPoint& newpos )
{ {
wxPoint delta = newpos - m_Pos; wxPoint delta = newpos - m_Pos;
...@@ -311,22 +304,20 @@ void MODULE::SetPosition( const wxPoint& newpos ) ...@@ -311,22 +304,20 @@ void MODULE::SetPosition( const wxPoint& newpos )
pad->m_Pos += delta; pad->m_Pos += delta;
} }
EDA_ITEM* PtStruct = m_Drawings; for( EDA_ITEM* item = m_Drawings; item; item = item->Next() )
for( ; PtStruct != NULL; PtStruct = PtStruct->Next() )
{ {
switch( PtStruct->Type() ) switch( item->Type() )
{ {
case PCB_MODULE_EDGE_T: case PCB_MODULE_EDGE_T:
{ {
EDGE_MODULE* pt_edgmod = (EDGE_MODULE*) PtStruct; EDGE_MODULE* pt_edgmod = (EDGE_MODULE*) item;
pt_edgmod->SetDrawCoord(); pt_edgmod->SetDrawCoord();
break; break;
} }
case PCB_MODULE_TEXT_T: case PCB_MODULE_TEXT_T:
{ {
TEXTE_MODULE* pt_texte = (TEXTE_MODULE*) PtStruct; TEXTE_MODULE* pt_texte = (TEXTE_MODULE*) item;
pt_texte->m_Pos += delta; pt_texte->m_Pos += delta;
break; break;
} }
...@@ -341,13 +332,14 @@ void MODULE::SetPosition( const wxPoint& newpos ) ...@@ -341,13 +332,14 @@ void MODULE::SetPosition( const wxPoint& newpos )
} }
void MODULE::SetOrientation( int newangle ) void MODULE::SetOrientation( double newangle )
{ {
int px, py; int px, py;
newangle -= m_Orient; // = Change in rotation newangle -= m_Orient; // = Change in rotation
m_Orient += newangle; m_Orient += newangle;
NORMALIZE_ANGLE_POS( m_Orient ); NORMALIZE_ANGLE_POS( m_Orient );
for( D_PAD* pad = m_Pads; pad; pad = pad->Next() ) for( D_PAD* pad = m_Pads; pad; pad = pad->Next() )
...@@ -355,7 +347,7 @@ void MODULE::SetOrientation( int newangle ) ...@@ -355,7 +347,7 @@ void MODULE::SetOrientation( int newangle )
px = pad->m_Pos0.x; px = pad->m_Pos0.x;
py = pad->m_Pos0.y; py = pad->m_Pos0.y;
pad->m_Orient += newangle; /* change m_Orientation */ pad->m_Orient += newangle; // change m_Orientation
NORMALIZE_ANGLE_POS( pad->m_Orient ); NORMALIZE_ANGLE_POS( pad->m_Orient );
RotatePoint( &px, &py, m_Orient ); RotatePoint( &px, &py, m_Orient );
...@@ -363,11 +355,11 @@ void MODULE::SetOrientation( int newangle ) ...@@ -363,11 +355,11 @@ void MODULE::SetOrientation( int newangle )
pad->m_Pos.y = m_Pos.y + py; pad->m_Pos.y = m_Pos.y + py;
} }
/* Update of the reference and value. */ // Update of the reference and value.
m_Reference->SetDrawCoord(); m_Reference->SetDrawCoord();
m_Value->SetDrawCoord(); m_Value->SetDrawCoord();
/* Displace contours and text of the footprint. */ // Displace contours and text of the footprint.
for( BOARD_ITEM* item = m_Drawings; item; item = item->Next() ) for( BOARD_ITEM* item = m_Drawings; item; item = item->Next() )
{ {
if( item->Type() == PCB_MODULE_EDGE_T ) if( item->Type() == PCB_MODULE_EDGE_T )
...@@ -376,7 +368,7 @@ void MODULE::SetOrientation( int newangle ) ...@@ -376,7 +368,7 @@ void MODULE::SetOrientation( int newangle )
pt_edgmod->SetDrawCoord(); pt_edgmod->SetDrawCoord();
} }
if( item->Type() == PCB_MODULE_TEXT_T ) else if( item->Type() == PCB_MODULE_TEXT_T )
{ {
TEXTE_MODULE* pt_texte = (TEXTE_MODULE*) item; TEXTE_MODULE* pt_texte = (TEXTE_MODULE*) item;
pt_texte->SetDrawCoord(); pt_texte->SetDrawCoord();
......
...@@ -56,12 +56,6 @@ void TEXTE_PCB::Copy( TEXTE_PCB* source ) ...@@ -56,12 +56,6 @@ void TEXTE_PCB::Copy( TEXTE_PCB* source )
} }
/*
* Function Draw
* Like tracks, texts are drawn in filled or sketch mode, never in line mode
* because the line mode does not keep the actual size of the text
* and the actual size is very important, especially for copper texts
*/
void TEXTE_PCB::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, void TEXTE_PCB::Draw( EDA_DRAW_PANEL* panel, wxDC* DC,
int DrawMode, const wxPoint& offset ) int DrawMode, const wxPoint& offset )
{ {
...@@ -85,7 +79,6 @@ void TEXTE_PCB::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, ...@@ -85,7 +79,6 @@ void TEXTE_PCB::Draw( EDA_DRAW_PANEL* panel, wxDC* DC,
} }
// see class_pcb_text.h
void TEXTE_PCB::DisplayInfo( EDA_DRAW_FRAME* frame ) void TEXTE_PCB::DisplayInfo( EDA_DRAW_FRAME* frame )
{ {
wxString msg; wxString msg;
...@@ -130,13 +123,7 @@ void TEXTE_PCB::DisplayInfo( EDA_DRAW_FRAME* frame ) ...@@ -130,13 +123,7 @@ void TEXTE_PCB::DisplayInfo( EDA_DRAW_FRAME* frame )
} }
/** void TEXTE_PCB::Rotate( const wxPoint& aRotCentre, double aAngle )
* Function Rotate
* Rotate this object.
* @param aRotCentre - the rotation point.
* @param aAngle - the rotation angle in 0.1 degree.
*/
void TEXTE_PCB::Rotate(const wxPoint& aRotCentre, int aAngle)
{ {
RotatePoint( &m_Pos, aRotCentre, aAngle ); RotatePoint( &m_Pos, aRotCentre, aAngle );
m_Orient += aAngle; m_Orient += aAngle;
...@@ -144,11 +131,6 @@ void TEXTE_PCB::Rotate(const wxPoint& aRotCentre, int aAngle) ...@@ -144,11 +131,6 @@ void TEXTE_PCB::Rotate(const wxPoint& aRotCentre, int aAngle)
} }
/**
* Function Flip
* Flip this object, i.e. change the board side for this object
* @param aCentre - the rotation point.
*/
void TEXTE_PCB::Flip(const wxPoint& aCentre ) void TEXTE_PCB::Flip(const wxPoint& aCentre )
{ {
m_Pos.y = aCentre.y - ( m_Pos.y - aCentre.y ); m_Pos.y = aCentre.y - ( m_Pos.y - aCentre.y );
......
...@@ -47,7 +47,7 @@ public: ...@@ -47,7 +47,7 @@ public:
* @param aRotCentre - the rotation point. * @param aRotCentre - the rotation point.
* @param aAngle - the rotation angle in 0.1 degree. * @param aAngle - the rotation angle in 0.1 degree.
*/ */
virtual void Rotate( const wxPoint& aRotCentre, int aAngle ); virtual void Rotate( const wxPoint& aRotCentre, double aAngle );
/** /**
* Function Flip * Function Flip
......
...@@ -186,7 +186,7 @@ wxString SEGVIA::GetSelectMenuText() const ...@@ -186,7 +186,7 @@ wxString SEGVIA::GetSelectMenuText() const
text << _( "Via" ) << wxT( " " ) << ShowWidth(); text << _( "Via" ) << wxT( " " ) << ShowWidth();
int shape = Shape(); int shape = GetShape();
if( shape == VIA_BLIND_BURIED ) if( shape == VIA_BLIND_BURIED )
text << wxT( " " ) << _( "Blind/Buried" ); text << wxT( " " ) << _( "Blind/Buried" );
...@@ -231,7 +231,7 @@ TRACK::TRACK( const TRACK& Source ) : ...@@ -231,7 +231,7 @@ TRACK::TRACK( const TRACK& Source ) :
m_Flags = Source.m_Flags; m_Flags = Source.m_Flags;
SetTimeStamp( Source.m_TimeStamp ); SetTimeStamp( Source.m_TimeStamp );
SetStatus( Source.ReturnStatus() ); SetStatus( Source.GetStatus() );
m_Start = Source.m_Start; m_Start = Source.m_Start;
m_End = Source.m_End; m_End = Source.m_End;
m_Width = Source.m_Width; m_Width = Source.m_Width;
...@@ -390,7 +390,7 @@ EDA_RECT TRACK::GetBoundingBox() const ...@@ -390,7 +390,7 @@ EDA_RECT TRACK::GetBoundingBox() const
} }
void TRACK::Rotate( const wxPoint& aRotCentre, int aAngle ) void TRACK::Rotate( const wxPoint& aRotCentre, double aAngle )
{ {
RotatePoint( &m_Start, aRotCentre, aAngle ); RotatePoint( &m_Start, aRotCentre, aAngle );
RotatePoint( &m_End, aRotCentre, aAngle ); RotatePoint( &m_End, aRotCentre, aAngle );
...@@ -451,7 +451,7 @@ int TRACK::ReturnMaskLayer() const ...@@ -451,7 +451,7 @@ int TRACK::ReturnMaskLayer() const
{ {
if( Type() == PCB_VIA_T ) if( Type() == PCB_VIA_T )
{ {
int via_type = Shape(); int via_type = GetShape();
if( via_type == VIA_THROUGH ) if( via_type == VIA_THROUGH )
return ALL_CU_LAYERS; return ALL_CU_LAYERS;
...@@ -481,7 +481,7 @@ int TRACK::ReturnMaskLayer() const ...@@ -481,7 +481,7 @@ int TRACK::ReturnMaskLayer() const
void SEGVIA::SetLayerPair( int top_layer, int bottom_layer ) void SEGVIA::SetLayerPair( int top_layer, int bottom_layer )
{ {
if( Shape() == VIA_THROUGH ) if( GetShape() == VIA_THROUGH )
{ {
top_layer = LAYER_N_FRONT; top_layer = LAYER_N_FRONT;
bottom_layer = LAYER_N_BACK; bottom_layer = LAYER_N_BACK;
...@@ -499,7 +499,7 @@ void SEGVIA::ReturnLayerPair( int* top_layer, int* bottom_layer ) const ...@@ -499,7 +499,7 @@ void SEGVIA::ReturnLayerPair( int* top_layer, int* bottom_layer ) const
int b_layer = LAYER_N_BACK; int b_layer = LAYER_N_BACK;
int t_layer = LAYER_N_FRONT; int t_layer = LAYER_N_FRONT;
if( Shape() != VIA_THROUGH ) if( GetShape() != VIA_THROUGH )
{ {
b_layer = (m_Layer >> 4) & 15; b_layer = (m_Layer >> 4) & 15;
t_layer = m_Layer & 15; t_layer = m_Layer & 15;
...@@ -888,7 +888,7 @@ void SEGVIA::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wxPoint ...@@ -888,7 +888,7 @@ void SEGVIA::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wxPoint
// for Micro Vias, draw a partial cross : X on component layer, or + on copper layer // for Micro Vias, draw a partial cross : X on component layer, or + on copper layer
// (so we can see 2 superimposed microvias ): // (so we can see 2 superimposed microvias ):
if( Shape() == VIA_MICROVIA ) if( GetShape() == VIA_MICROVIA )
{ {
int ax, ay, bx, by; int ax, ay, bx, by;
...@@ -926,7 +926,7 @@ void SEGVIA::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wxPoint ...@@ -926,7 +926,7 @@ void SEGVIA::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wxPoint
// for Buried Vias, draw a partial line : orient depending on layer pair // for Buried Vias, draw a partial line : orient depending on layer pair
// (so we can see superimposed buried vias ): // (so we can see superimposed buried vias ):
if( Shape() == VIA_BLIND_BURIED ) if( GetShape() == VIA_BLIND_BURIED )
{ {
int ax = 0, ay = radius, bx = 0, by = drill_radius; int ax = 0, ay = radius, bx = 0, by = drill_radius;
int layer_top, layer_bottom; int layer_top, layer_bottom;
...@@ -1041,7 +1041,7 @@ void TRACK::DisplayInfoBase( EDA_DRAW_FRAME* frame ) ...@@ -1041,7 +1041,7 @@ void TRACK::DisplayInfoBase( EDA_DRAW_FRAME* frame )
switch( Type() ) switch( Type() )
{ {
case PCB_VIA_T: case PCB_VIA_T:
switch( Shape() ) switch( GetShape() )
{ {
default: default:
case 0: case 0:
...@@ -1593,7 +1593,7 @@ void SEGVIA::Show( int nestLevel, std::ostream& os ) ...@@ -1593,7 +1593,7 @@ void SEGVIA::Show( int nestLevel, std::ostream& os )
{ {
const char* cp; const char* cp;
switch( Shape() ) switch( GetShape() )
{ {
case VIA_THROUGH: case VIA_THROUGH:
cp = "through"; cp = "through";
......
...@@ -65,7 +65,7 @@ public: ...@@ -65,7 +65,7 @@ public:
BOARD_CONNECTED_ITEM* start; // pointers to a connected item (pad or track) BOARD_CONNECTED_ITEM* start; // pointers to a connected item (pad or track)
BOARD_CONNECTED_ITEM* end; BOARD_CONNECTED_ITEM* end;
int m_Param; // Auxiliary variable ( used in some computations ) double m_Param; // Auxiliary variable ( used in some computations )
protected: protected:
TRACK( const TRACK& track ); // protected so Copy() is used instead. TRACK( const TRACK& track ); // protected so Copy() is used instead.
...@@ -108,7 +108,7 @@ public: ...@@ -108,7 +108,7 @@ public:
* @param aRotCentre - the rotation point. * @param aRotCentre - the rotation point.
* @param aAngle - the rotation angle in 0.1 degree. * @param aAngle - the rotation angle in 0.1 degree.
*/ */
virtual void Rotate( const wxPoint& aRotCentre, int aAngle ); virtual void Rotate( const wxPoint& aRotCentre, double aAngle );
/** /**
* Function Flip * Function Flip
...@@ -117,17 +117,17 @@ public: ...@@ -117,17 +117,17 @@ public:
*/ */
virtual void Flip( const wxPoint& aCentre ); virtual void Flip( const wxPoint& aCentre );
const wxPoint GetPosition() const // overload void SetPosition( const wxPoint& aPos ) { m_Start = aPos; } // overload
{ const wxPoint GetPosition() const { return m_Start; } // overload
return m_Start; // it had to be start or end.
}
int GetWidth() const { return m_Width; }
void SetWidth( int aWidth ) { m_Width = aWidth; } void SetWidth( int aWidth ) { m_Width = aWidth; }
int GetWidth() const { return m_Width; }
void SetPosition( const wxPoint& aPos ) { m_Start = aPos; } // overload
void SetEnd( const wxPoint& aEnd ) { m_End = aEnd; } void SetEnd( const wxPoint& aEnd ) { m_End = aEnd; }
const wxPoint& GetEnd() const { return m_End; }
void SetStart( const wxPoint& aStart ) { m_Start = aStart; }
const wxPoint& GetStart() const { return m_Start; }
EDA_RECT GetBoundingBox() const; EDA_RECT GetBoundingBox() const;
...@@ -166,8 +166,8 @@ public: ...@@ -166,8 +166,8 @@ public:
*/ */
double GetLength() const double GetLength() const
{ {
int dx = m_Start.x - m_End.x; double dx = m_Start.x - m_End.x;
int dy = m_Start.y - m_End.y; double dy = m_Start.y - m_End.y;
return hypot( dx, dy ); return hypot( dx, dy );
} }
...@@ -177,7 +177,7 @@ public: ...@@ -177,7 +177,7 @@ public:
const wxPoint& aOffset = ZeroOffset ); const wxPoint& aOffset = ZeroOffset );
/* divers */ /* divers */
int Shape() const { return m_Shape & 0xFF; } int GetShape() const { return m_Shape & 0xFF; }
void SetShape( int aShape ) { m_Shape = aShape; } void SetShape( int aShape ) { m_Shape = aShape; }
/** /**
...@@ -201,26 +201,34 @@ public: ...@@ -201,26 +201,34 @@ public:
* Set the drill value for vias * Set the drill value for vias
* @param drill_value = new drill value * @param drill_value = new drill value
*/ */
void SetDrillValue( int drill_value ) { m_Drill = drill_value; } void SetDrill( int aDrill ) { m_Drill = aDrill; }
/**
* Function GetDrill
* returns the local drill setting for this VIA. If you want the calculated value,
* use GetDrillValue() instead.
*/
int GetDrill() const { return m_Drill; }
/**
* Function GetDrillValue
* "calculates" the drill value for vias (m-Drill if > 0, or default
* drill value for the board.
* @return real drill_value
*/
int GetDrillValue() const;
/** /**
* Function SetDrillDefault * Function SetDrillDefault
* Set the drill value for vias at default value (-1) * Set the drill value for vias at default value (-1)
*/ */
void SetDrillDefault( void ) { m_Drill = -1; } void SetDrillDefault() { m_Drill = -1; }
/** /**
* Function IsDrillDefault * Function IsDrillDefault
* @return true if the drill value is default value (-1) * @return true if the drill value is default value (-1)
*/ */
bool IsDrillDefault( void ) { return m_Drill <= 0; } bool IsDrillDefault() { return m_Drill <= 0; }
/**
* Function GetDrillValue
* calculate the drill value for vias (m-Drill if > 0, or default drill value for the board
* @return real drill_value
*/
int GetDrillValue() const;
/** /**
* Function ReturnMaskLayer * Function ReturnMaskLayer
......
...@@ -737,7 +737,7 @@ void ZONE_CONTAINER::MoveEdge( const wxPoint& offset ) ...@@ -737,7 +737,7 @@ void ZONE_CONTAINER::MoveEdge( const wxPoint& offset )
} }
void ZONE_CONTAINER::Rotate( const wxPoint& centre, int angle ) void ZONE_CONTAINER::Rotate( const wxPoint& centre, double angle )
{ {
wxPoint pos; wxPoint pos;
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
* @brief Classes to handle copper zones * @brief Classes to handle copper zones
*/ */
#ifndef CLASS_ZONE_H #ifndef CLASS_ZONE_H_
#define CLASS_ZONE_H #define CLASS_ZONE_H_
#include <vector> #include <vector>
...@@ -41,7 +41,7 @@ struct SEGMENT ...@@ -41,7 +41,7 @@ struct SEGMENT
m_Start = aStart; m_Start = aStart;
m_End = aEnd; m_End = aEnd;
} }
}; };
/** /**
...@@ -103,7 +103,6 @@ private: ...@@ -103,7 +103,6 @@ private:
public: public:
ZONE_CONTAINER( BOARD* parent ); ZONE_CONTAINER( BOARD* parent );
~ZONE_CONTAINER(); ~ZONE_CONTAINER();
bool Save( FILE* aFile ) const; bool Save( FILE* aFile ) const;
...@@ -224,9 +223,9 @@ public: ...@@ -224,9 +223,9 @@ public:
/** /**
* Function GetNetName * Function GetNetName
* returns the net name. * returns the net name.
* @return wxString - The net name. * @return const wxString& - The net name.
*/ */
wxString GetNetName() const { return m_Netname; }; const wxString& GetNetName() const { return m_Netname; };
void SetNetName( const wxString& aName ) { m_Netname = aName; } void SetNetName( const wxString& aName ) { m_Netname = aName; }
void SetFillMode( int aFillMode ) { m_FillMode = aFillMode; } void SetFillMode( int aFillMode ) { m_FillMode = aFillMode; }
...@@ -392,7 +391,7 @@ public: ...@@ -392,7 +391,7 @@ public:
* @param centre = rot centre * @param centre = rot centre
* @param angle = in 0.1 degree * @param angle = in 0.1 degree
*/ */
void Rotate( const wxPoint& centre, int angle ); void Rotate( const wxPoint& centre, double angle );
/** /**
* Function Flip * Function Flip
...@@ -420,10 +419,10 @@ public: ...@@ -420,10 +419,10 @@ public:
return wxT( "ZONE_CONTAINER" ); return wxT( "ZONE_CONTAINER" );
} }
/** Access to m_Poly parameters /** Access to m_Poly parameters
*/ */
int GetNumCorners( void ) const int GetNumCorners( void ) const
{ {
return m_Poly->GetNumCorners(); return m_Poly->GetNumCorners();
...@@ -500,4 +499,4 @@ public: ...@@ -500,4 +499,4 @@ public:
}; };
#endif // #ifndef CLASS_ZONE_H #endif // CLASS_ZONE_H_
...@@ -147,7 +147,7 @@ void clean_vias( BOARD * aPcb ) ...@@ -147,7 +147,7 @@ void clean_vias( BOARD * aPcb )
for( track = aPcb->m_Track; track; track = track->Next() ) for( track = aPcb->m_Track; track; track = track->Next() )
{ {
if( track->Shape() != VIA_THROUGH ) if( track->GetShape() != VIA_THROUGH )
continue; continue;
// Search and delete others vias at same location // Search and delete others vias at same location
......
...@@ -73,7 +73,7 @@ void DIALOG_MODULE_BOARD_EDITOR::InitBoardProperties() ...@@ -73,7 +73,7 @@ void DIALOG_MODULE_BOARD_EDITOR::InitBoardProperties()
(m_CurrentModule->GetLayer() == LAYER_N_BACK) ? 1 : 0 ); (m_CurrentModule->GetLayer() == LAYER_N_BACK) ? 1 : 0 );
bool select = FALSE; bool select = FALSE;
switch( m_CurrentModule->m_Orient ) switch( (int) m_CurrentModule->GetOrientation() )
{ {
case 0: case 0:
m_OrientCtrl->SetSelection( 0 ); m_OrientCtrl->SetSelection( 0 );
......
...@@ -164,11 +164,11 @@ void DIALOG_GENDRILL::InitDisplayParams( void ) ...@@ -164,11 +164,11 @@ void DIALOG_GENDRILL::InitDisplayParams( void )
if( track->Type() != PCB_VIA_T ) if( track->Type() != PCB_VIA_T )
continue; continue;
if( track->Shape() == VIA_THROUGH ) if( track->GetShape() == VIA_THROUGH )
m_throughViasCount++; m_throughViasCount++;
else if( track->Shape() == VIA_MICROVIA ) else if( track->GetShape() == VIA_MICROVIA )
m_microViasCount++; m_microViasCount++;
else if( track->Shape() == VIA_BLIND_BURIED ) else if( track->GetShape() == VIA_BLIND_BURIED )
m_blindOrBuriedViasCount++; m_blindOrBuriedViasCount++;
} }
......
...@@ -90,7 +90,7 @@ void DialogGraphicItemProperties::initDlg( ) ...@@ -90,7 +90,7 @@ void DialogGraphicItemProperties::initDlg( )
wxString msg; wxString msg;
// Change texts according to the segment shape: // Change texts according to the segment shape:
switch ( m_Item->m_Shape ) switch ( m_Item->GetShape() )
{ {
case S_CIRCLE: case S_CIRCLE:
m_Start_Center_XText->SetLabel(_("Center X")); m_Start_Center_XText->SetLabel(_("Center X"));
...@@ -106,7 +106,7 @@ void DialogGraphicItemProperties::initDlg( ) ...@@ -106,7 +106,7 @@ void DialogGraphicItemProperties::initDlg( )
m_Start_Center_YText->SetLabel(_("Center Y")); m_Start_Center_YText->SetLabel(_("Center Y"));
m_EndX_Radius_Text->SetLabel(_("Start Point X")); m_EndX_Radius_Text->SetLabel(_("Start Point X"));
m_EndY_Text->SetLabel(_("Start Point Y")); m_EndY_Text->SetLabel(_("Start Point Y"));
msg << m_Item->m_Angle; msg << m_Item->GetAngle();
m_Angle_Ctrl->SetValue(msg); m_Angle_Ctrl->SetValue(msg);
break; break;
...@@ -118,23 +118,23 @@ void DialogGraphicItemProperties::initDlg( ) ...@@ -118,23 +118,23 @@ void DialogGraphicItemProperties::initDlg( )
AddUnitSymbol( *m_Start_Center_XText ); AddUnitSymbol( *m_Start_Center_XText );
PutValueInLocalUnits( *m_Center_StartXCtrl, m_Item->m_Start.x, PutValueInLocalUnits( *m_Center_StartXCtrl, m_Item->GetStart().x,
m_Parent->m_InternalUnits ); m_Parent->m_InternalUnits );
AddUnitSymbol( *m_Start_Center_YText ); AddUnitSymbol( *m_Start_Center_YText );
PutValueInLocalUnits( *m_Center_StartYCtrl, m_Item->m_Start.y, PutValueInLocalUnits( *m_Center_StartYCtrl, m_Item->GetStart().y,
m_Parent->m_InternalUnits ); m_Parent->m_InternalUnits );
AddUnitSymbol( *m_EndX_Radius_Text ); AddUnitSymbol( *m_EndX_Radius_Text );
PutValueInLocalUnits( *m_EndX_Radius_Ctrl, m_Item->m_End.x, PutValueInLocalUnits( *m_EndX_Radius_Ctrl, m_Item->GetEnd().x,
m_Parent->m_InternalUnits ); m_Parent->m_InternalUnits );
AddUnitSymbol( *m_EndY_Text ); AddUnitSymbol( *m_EndY_Text );
PutValueInLocalUnits( *m_EndY_Ctrl, m_Item->m_End.y, PutValueInLocalUnits( *m_EndY_Ctrl, m_Item->GetEnd().y,
m_Parent->m_InternalUnits ); m_Parent->m_InternalUnits );
AddUnitSymbol( *m_ItemThicknessText ); AddUnitSymbol( *m_ItemThicknessText );
PutValueInLocalUnits( *m_ThicknessCtrl, m_Item->m_Width, PutValueInLocalUnits( *m_ThicknessCtrl, m_Item->GetWidth(),
m_Parent->m_InternalUnits ); m_Parent->m_InternalUnits );
AddUnitSymbol( *m_DefaultThicknessText ); AddUnitSymbol( *m_DefaultThicknessText );
...@@ -192,28 +192,22 @@ void DialogGraphicItemProperties::OnOkClick( wxCommandEvent& event ) ...@@ -192,28 +192,22 @@ void DialogGraphicItemProperties::OnOkClick( wxCommandEvent& event )
m_Item->Draw( m_Parent->DrawPanel, m_DC, GR_XOR ); m_Item->Draw( m_Parent->DrawPanel, m_DC, GR_XOR );
msg = m_Center_StartXCtrl->GetValue(); msg = m_Center_StartXCtrl->GetValue();
m_Item->m_Start.x = ReturnValueFromString( g_UserUnit, msg, m_Item->SetStartX( ReturnValueFromString( g_UserUnit, msg, m_Parent->m_InternalUnits ));
m_Parent->m_InternalUnits );
msg = m_Center_StartYCtrl->GetValue(); msg = m_Center_StartYCtrl->GetValue();
m_Item->m_Start.y = ReturnValueFromString( g_UserUnit, msg, m_Item->SetStartY( ReturnValueFromString( g_UserUnit, msg, m_Parent->m_InternalUnits ));
m_Parent->m_InternalUnits );
msg = m_EndX_Radius_Ctrl->GetValue(); msg = m_EndX_Radius_Ctrl->GetValue();
m_Item->m_End.x = ReturnValueFromString( g_UserUnit, msg, m_Item->SetEndX( ReturnValueFromString( g_UserUnit, msg, m_Parent->m_InternalUnits ));
m_Parent->m_InternalUnits );
msg = m_EndY_Ctrl->GetValue(); msg = m_EndY_Ctrl->GetValue();
m_Item->m_End.y = ReturnValueFromString( g_UserUnit, msg, m_Item->SetEndY( ReturnValueFromString( g_UserUnit, msg, m_Parent->m_InternalUnits ));
m_Parent->m_InternalUnits );
msg = m_ThicknessCtrl->GetValue(); msg = m_ThicknessCtrl->GetValue();
m_Item->m_Width = ReturnValueFromString( g_UserUnit, msg, m_Item->SetWidth( ReturnValueFromString( g_UserUnit, msg, m_Parent->m_InternalUnits ));
m_Parent->m_InternalUnits );
msg = m_DefaultThicknessCtrl->GetValue(); msg = m_DefaultThicknessCtrl->GetValue();
int thickness = ReturnValueFromString( g_UserUnit, msg, int thickness = ReturnValueFromString( g_UserUnit, msg, m_Parent->m_InternalUnits );
m_Parent->m_InternalUnits );
m_Item->SetLayer( m_LayerSelection->GetCurrentSelection() + FIRST_NO_COPPER_LAYER); m_Item->SetLayer( m_LayerSelection->GetCurrentSelection() + FIRST_NO_COPPER_LAYER);
...@@ -222,12 +216,12 @@ void DialogGraphicItemProperties::OnOkClick( wxCommandEvent& event ) ...@@ -222,12 +216,12 @@ void DialogGraphicItemProperties::OnOkClick( wxCommandEvent& event )
else else
m_BrdSettings.m_DrawSegmentWidth = thickness; m_BrdSettings.m_DrawSegmentWidth = thickness;
if( m_Item->m_Shape == S_ARC ) if( m_Item->GetShape() == S_ARC )
{ {
long angle; double angle;
m_Angle_Ctrl->GetValue().ToLong(&angle); m_Angle_Ctrl->GetValue().ToDouble( &angle );
NORMALIZE_ANGLE_360(angle); NORMALIZE_ANGLE_360(angle);
m_Item->m_Angle = angle; m_Item->SetAngle( angle );
} }
m_Parent->OnModify(); m_Parent->OnModify();
......
...@@ -114,7 +114,7 @@ void DIALOG_PCB_TEXT_PROPERTIES::MyInit() ...@@ -114,7 +114,7 @@ void DIALOG_PCB_TEXT_PROPERTIES::MyInit()
} }
} }
switch( m_SelectedPCBText->m_Orient ) switch( (int) m_SelectedPCBText->GetOrientation() )
{ {
default: default:
m_OrientationCtrl->SetSelection( 0 ); m_OrientationCtrl->SetSelection( 0 );
......
...@@ -83,18 +83,18 @@ DIALOG_DIMENSION_EDITOR::DIALOG_DIMENSION_EDITOR( PCB_EDIT_FRAME* aParent, ...@@ -83,18 +83,18 @@ DIALOG_DIMENSION_EDITOR::DIALOG_DIMENSION_EDITOR( PCB_EDIT_FRAME* aParent,
CurrentDimension = aDimension; CurrentDimension = aDimension;
if( aDimension->m_Text->m_Mirror ) if( aDimension->m_Text.m_Mirror )
m_rbMirror->SetSelection( 1 ); m_rbMirror->SetSelection( 1 );
else else
m_rbMirror->SetSelection( 0 ); m_rbMirror->SetSelection( 0 );
m_Name->SetValue( aDimension->m_Text->m_Text ); m_Name->SetValue( aDimension->m_Text.m_Text );
// Enter size value in dialog // Enter size value in dialog
PutValueInLocalUnits( *m_TxtSizeXCtrl, aDimension->m_Text->m_Size.x, PutValueInLocalUnits( *m_TxtSizeXCtrl, aDimension->m_Text.m_Size.x,
m_Parent->m_InternalUnits ); m_Parent->m_InternalUnits );
AddUnitSymbol( *m_staticTextSizeX ); AddUnitSymbol( *m_staticTextSizeX );
PutValueInLocalUnits( *m_TxtSizeYCtrl, aDimension->m_Text->m_Size.y, PutValueInLocalUnits( *m_TxtSizeYCtrl, aDimension->m_Text.m_Size.y,
m_Parent->m_InternalUnits ); m_Parent->m_InternalUnits );
AddUnitSymbol( *m_staticTextSizeY ); AddUnitSymbol( *m_staticTextSizeY );
...@@ -104,10 +104,10 @@ DIALOG_DIMENSION_EDITOR::DIALOG_DIMENSION_EDITOR( PCB_EDIT_FRAME* aParent, ...@@ -104,10 +104,10 @@ DIALOG_DIMENSION_EDITOR::DIALOG_DIMENSION_EDITOR( PCB_EDIT_FRAME* aParent,
AddUnitSymbol( *m_staticTextWidth ); AddUnitSymbol( *m_staticTextWidth );
// Enter position value in dialog // Enter position value in dialog
PutValueInLocalUnits( *m_textCtrlPosX, aDimension->m_Text->m_Pos.x, PutValueInLocalUnits( *m_textCtrlPosX, aDimension->m_Text.m_Pos.x,
m_Parent->m_InternalUnits ); m_Parent->m_InternalUnits );
AddUnitSymbol( *m_staticTextPosX ); AddUnitSymbol( *m_staticTextPosX );
PutValueInLocalUnits( *m_textCtrlPosY, aDimension->m_Text->m_Pos.y, PutValueInLocalUnits( *m_textCtrlPosY, aDimension->m_Text.m_Pos.y,
m_Parent->m_InternalUnits ); m_Parent->m_InternalUnits );
AddUnitSymbol( *m_staticTextPosY ); AddUnitSymbol( *m_staticTextPosY );
...@@ -148,26 +148,26 @@ void DIALOG_DIMENSION_EDITOR::OnOKClick( wxCommandEvent& event ) ...@@ -148,26 +148,26 @@ void DIALOG_DIMENSION_EDITOR::OnOKClick( wxCommandEvent& event )
// Get new size value: // Get new size value:
msg = m_TxtSizeXCtrl->GetValue(); msg = m_TxtSizeXCtrl->GetValue();
CurrentDimension->m_Text->m_Size.x = ReturnValueFromString( g_UserUnit, msg, CurrentDimension->m_Text.m_Size.x = ReturnValueFromString( g_UserUnit, msg,
m_Parent->m_InternalUnits ); m_Parent->m_InternalUnits );
msg = m_TxtSizeYCtrl->GetValue(); msg = m_TxtSizeYCtrl->GetValue();
CurrentDimension->m_Text->m_Size.y = ReturnValueFromString( g_UserUnit, msg, CurrentDimension->m_Text.m_Size.y = ReturnValueFromString( g_UserUnit, msg,
m_Parent->m_InternalUnits ); m_Parent->m_InternalUnits );
// Get new position value: // Get new position value:
// It will be copied later in dimension, because // It will be copied later in dimension, because
msg = m_textCtrlPosX->GetValue(); msg = m_textCtrlPosX->GetValue();
CurrentDimension->m_Text->m_Pos.x = ReturnValueFromString( g_UserUnit, msg, CurrentDimension->m_Text.m_Pos.x = ReturnValueFromString( g_UserUnit, msg,
m_Parent->m_InternalUnits ); m_Parent->m_InternalUnits );
msg = m_textCtrlPosY->GetValue(); msg = m_textCtrlPosY->GetValue();
CurrentDimension->m_Text->m_Pos.y = ReturnValueFromString( g_UserUnit, msg, CurrentDimension->m_Text.m_Pos.y = ReturnValueFromString( g_UserUnit, msg,
m_Parent->m_InternalUnits ); m_Parent->m_InternalUnits );
// Get new line thickness value: // Get new line thickness value:
msg = m_TxtWidthCtrl->GetValue(); msg = m_TxtWidthCtrl->GetValue();
int width = ReturnValueFromString( g_UserUnit, msg, int width = ReturnValueFromString( g_UserUnit, msg,
m_Parent->m_InternalUnits ); m_Parent->m_InternalUnits );
int maxthickness = Clamp_Text_PenSize( width, CurrentDimension->m_Text->m_Size ); int maxthickness = Clamp_Text_PenSize( width, CurrentDimension->m_Text.m_Size );
if( width > maxthickness ) if( width > maxthickness )
{ {
...@@ -176,9 +176,9 @@ void DIALOG_DIMENSION_EDITOR::OnOKClick( wxCommandEvent& event ) ...@@ -176,9 +176,9 @@ void DIALOG_DIMENSION_EDITOR::OnOKClick( wxCommandEvent& event )
width = maxthickness; width = maxthickness;
} }
CurrentDimension->m_Text->m_Thickness = CurrentDimension->m_Width = width ; CurrentDimension->m_Text.m_Thickness = CurrentDimension->m_Width = width ;
CurrentDimension->m_Text->m_Mirror = ( m_rbMirror->GetSelection() == 1 ) ? true : false; CurrentDimension->m_Text.m_Mirror = ( m_rbMirror->GetSelection() == 1 ) ? true : false;
CurrentDimension->SetLayer( m_SelLayerBox->GetCurrentSelection() + FIRST_NO_COPPER_LAYER ); CurrentDimension->SetLayer( m_SelLayerBox->GetCurrentSelection() + FIRST_NO_COPPER_LAYER );
...@@ -249,16 +249,16 @@ DIMENSION* PCB_EDIT_FRAME::EditDimension( DIMENSION* aDimension, wxDC* aDC ) ...@@ -249,16 +249,16 @@ DIMENSION* PCB_EDIT_FRAME::EditDimension( DIMENSION* aDimension, wxDC* aDC )
aDimension->m_arrowD2Ox = aDimension->m_arrowD2Fx = pos.x; aDimension->m_arrowD2Ox = aDimension->m_arrowD2Fx = pos.x;
aDimension->m_arrowD2Oy = aDimension->m_arrowD2Fy = pos.y; aDimension->m_arrowD2Oy = aDimension->m_arrowD2Fy = pos.y;
aDimension->m_Text->m_Size = GetBoard()->GetDesignSettings().m_PcbTextSize; aDimension->m_Text.m_Size = GetBoard()->GetDesignSettings().m_PcbTextSize;
int width = GetBoard()->GetDesignSettings().m_PcbTextWidth; int width = GetBoard()->GetDesignSettings().m_PcbTextWidth;
int maxthickness = Clamp_Text_PenSize(width, aDimension->m_Text->m_Size ); int maxthickness = Clamp_Text_PenSize(width, aDimension->m_Text.m_Size );
if( width > maxthickness ) if( width > maxthickness )
{ {
width = maxthickness; width = maxthickness;
} }
aDimension->m_Text->m_Thickness = aDimension->m_Width = width ; aDimension->m_Text.m_Thickness = aDimension->m_Width = width ;
aDimension->AdjustDimensionDetails( ); aDimension->AdjustDimensionDetails( );
...@@ -377,13 +377,13 @@ void PCB_EDIT_FRAME::BeginMoveDimensionText( DIMENSION* aItem, wxDC* DC ) ...@@ -377,13 +377,13 @@ void PCB_EDIT_FRAME::BeginMoveDimensionText( DIMENSION* aItem, wxDC* DC )
return; return;
// Store the initial position for undo/abort command // Store the initial position for undo/abort command
initialTextPosition = aItem->m_Text->m_Pos; initialTextPosition = aItem->m_Text.m_Pos;
aItem->Draw( DrawPanel, DC, GR_XOR ); aItem->Draw( DrawPanel, DC, GR_XOR );
aItem->m_Flags |= IS_MOVED; aItem->m_Flags |= IS_MOVED;
aItem->DisplayInfo( this ); aItem->DisplayInfo( this );
GetScreen()->SetCrossHairPosition( aItem->m_Text->m_Pos ); GetScreen()->SetCrossHairPosition( aItem->m_Text.m_Pos );
DrawPanel->MoveCursorToCrossHair(); DrawPanel->MoveCursorToCrossHair();
DrawPanel->SetMouseCapture( MoveDimensionText, AbortMoveDimensionText ); DrawPanel->SetMouseCapture( MoveDimensionText, AbortMoveDimensionText );
...@@ -404,7 +404,7 @@ static void MoveDimensionText( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& ...@@ -404,7 +404,7 @@ static void MoveDimensionText( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint&
if( aErase ) if( aErase )
dimension->Draw( aPanel, aDC, GR_XOR ); dimension->Draw( aPanel, aDC, GR_XOR );
dimension->m_Text->m_Pos = aPanel->GetScreen()->GetCrossHairPosition(); dimension->m_Text.m_Pos = aPanel->GetScreen()->GetCrossHairPosition();
dimension->Draw( aPanel, aDC, GR_XOR ); dimension->Draw( aPanel, aDC, GR_XOR );
} }
...@@ -425,7 +425,7 @@ void AbortMoveDimensionText( EDA_DRAW_PANEL* aPanel, wxDC* aDC ) ...@@ -425,7 +425,7 @@ void AbortMoveDimensionText( EDA_DRAW_PANEL* aPanel, wxDC* aDC )
return; return;
dimension->Draw( aPanel, aDC, GR_XOR ); dimension->Draw( aPanel, aDC, GR_XOR );
dimension->m_Text->m_Pos = initialTextPosition; dimension->m_Text.m_Pos = initialTextPosition;
dimension->m_Flags = 0; dimension->m_Flags = 0;
dimension->Draw( aPanel, aDC, GR_OR ); dimension->Draw( aPanel, aDC, GR_OR );
} }
...@@ -444,9 +444,9 @@ void PCB_EDIT_FRAME::PlaceDimensionText( DIMENSION* aItem, wxDC* DC ) ...@@ -444,9 +444,9 @@ void PCB_EDIT_FRAME::PlaceDimensionText( DIMENSION* aItem, wxDC* DC )
aItem->Draw( DrawPanel, DC, GR_OR ); aItem->Draw( DrawPanel, DC, GR_OR );
OnModify(); OnModify();
EXCHG( aItem->m_Text->m_Pos, initialTextPosition ); EXCHG( aItem->m_Text.m_Pos, initialTextPosition );
SaveCopyInUndoList( aItem, UR_CHANGED ); SaveCopyInUndoList( aItem, UR_CHANGED );
EXCHG( aItem->m_Text->m_Pos, initialTextPosition ); EXCHG( aItem->m_Text.m_Pos, initialTextPosition );
aItem->m_Flags = 0; aItem->m_Flags = 0;
} }
...@@ -175,7 +175,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads ) ...@@ -175,7 +175,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
if( aRefSeg->Type() == PCB_VIA_T ) if( aRefSeg->Type() == PCB_VIA_T )
{ {
// test if the via size is smaller than minimum // test if the via size is smaller than minimum
if( aRefSeg->Shape() == VIA_MICROVIA ) if( aRefSeg->GetShape() == VIA_MICROVIA )
{ {
if( aRefSeg->m_Width < netclass->GetuViaMinDiameter() ) if( aRefSeg->m_Width < netclass->GetuViaMinDiameter() )
{ {
...@@ -207,7 +207,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads ) ...@@ -207,7 +207,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
// For microvias: test if they are blind vias and only between 2 layers // For microvias: test if they are blind vias and only between 2 layers
// because they are used for very small drill size and are drill by laser // because they are used for very small drill size and are drill by laser
// and **only one layer** can be drilled // and **only one layer** can be drilled
if( aRefSeg->Shape() == VIA_MICROVIA ) if( aRefSeg->GetShape() == VIA_MICROVIA )
{ {
int layer1, layer2; int layer1, layer2;
bool err = true; bool err = true;
......
...@@ -29,7 +29,7 @@ static void Abort_Move_ModuleOutline( EDA_DRAW_PANEL* Panel, wxDC* DC ); ...@@ -29,7 +29,7 @@ static void Abort_Move_ModuleOutline( EDA_DRAW_PANEL* Panel, wxDC* DC );
static void ShowCurrentOutlineWhileMoving( EDA_DRAW_PANEL* aPanel, wxDC* aDC, static void ShowCurrentOutlineWhileMoving( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
const wxPoint& aPosition, bool aErase ); const wxPoint& aPosition, bool aErase );
int ArcValue = 900; static double ArcValue = 900;
static wxPoint MoveVector; // Move vector for move edge static wxPoint MoveVector; // Move vector for move edge
static wxPoint CursorInitialPosition; // Mouse cursor initial position for move command static wxPoint CursorInitialPosition; // Mouse cursor initial position for move command
...@@ -49,23 +49,25 @@ void FOOTPRINT_EDIT_FRAME::Start_Move_EdgeMod( EDGE_MODULE* Edge, wxDC* DC ) ...@@ -49,23 +49,25 @@ void FOOTPRINT_EDIT_FRAME::Start_Move_EdgeMod( EDGE_MODULE* Edge, wxDC* DC )
} }
void FOOTPRINT_EDIT_FRAME::Place_EdgeMod( EDGE_MODULE* Edge ) void FOOTPRINT_EDIT_FRAME::Place_EdgeMod( EDGE_MODULE* aEdge )
{ {
if( Edge == NULL ) if( aEdge == NULL )
return; return;
Edge->m_Start -= MoveVector; aEdge->SetStart( aEdge->GetStart() - MoveVector );
Edge->m_End -= MoveVector; aEdge->SetEnd( aEdge->GetEnd() - MoveVector );
Edge->m_Start0 -= MoveVector; aEdge->SetStart0( aEdge->GetStart0() - MoveVector );
Edge->m_End0 -= MoveVector; aEdge->SetEnd0( aEdge->GetEnd0() - MoveVector );
Edge->m_Flags = 0; aEdge->m_Flags = 0;
DrawPanel->SetMouseCapture( NULL, NULL ); DrawPanel->SetMouseCapture( NULL, NULL );
SetCurItem( NULL ); SetCurItem( NULL );
OnModify(); OnModify();
MODULE* Module = (MODULE*) Edge->GetParent();
Module->CalculateBoundingBox(); MODULE* module = (MODULE*) aEdge->GetParent();
module->CalculateBoundingBox();
DrawPanel->Refresh( ); DrawPanel->Refresh( );
} }
...@@ -109,22 +111,27 @@ static void ShowNewEdgeModule( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& ...@@ -109,22 +111,27 @@ static void ShowNewEdgeModule( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint&
if( Edge == NULL ) if( Edge == NULL )
return; return;
MODULE* Module = (MODULE*) Edge->GetParent(); MODULE* module = (MODULE*) Edge->GetParent();
// if( erase ) // if( erase )
{ {
Edge->Draw( aPanel, aDC, GR_XOR ); Edge->Draw( aPanel, aDC, GR_XOR );
} }
Edge->m_End = screen->GetCrossHairPosition(); Edge->SetEnd( screen->GetCrossHairPosition() );
// Update relative coordinate.
Edge->SetEnd0( Edge->GetEnd() - module->GetPosition() );
wxPoint pt( Edge->GetEnd0() );
/* Update relative coordinate. */ RotatePoint( &pt, -module->GetOrientation() );
Edge->m_End0 = Edge->m_End - Module->m_Pos;
RotatePoint( &Edge->m_End0, -Module->m_Orient ); Edge->SetEnd0( pt );
Edge->Draw( aPanel, aDC, GR_XOR ); Edge->Draw( aPanel, aDC, GR_XOR );
Module->CalculateBoundingBox(); module->CalculateBoundingBox();
} }
...@@ -143,12 +150,12 @@ void FOOTPRINT_EDIT_FRAME::Edit_Edge_Width( EDGE_MODULE* aEdge ) ...@@ -143,12 +150,12 @@ void FOOTPRINT_EDIT_FRAME::Edit_Edge_Width( EDGE_MODULE* aEdge )
if( aEdge->Type() != PCB_MODULE_EDGE_T ) if( aEdge->Type() != PCB_MODULE_EDGE_T )
continue; continue;
aEdge->m_Width = g_ModuleSegmentWidth; aEdge->SetWidth( g_ModuleSegmentWidth );
} }
} }
else else
{ {
aEdge->m_Width = g_ModuleSegmentWidth; aEdge->SetWidth( g_ModuleSegmentWidth );
} }
OnModify(); OnModify();
...@@ -222,9 +229,9 @@ void FOOTPRINT_EDIT_FRAME::Enter_Edge_Width( EDGE_MODULE* aEdge ) ...@@ -222,9 +229,9 @@ void FOOTPRINT_EDIT_FRAME::Enter_Edge_Width( EDGE_MODULE* aEdge )
if( aEdge ) if( aEdge )
{ {
MODULE* Module = GetBoard()->m_Modules; MODULE* module = GetBoard()->m_Modules;
aEdge->m_Width = g_ModuleSegmentWidth; aEdge->SetWidth( g_ModuleSegmentWidth );
Module->CalculateBoundingBox(); module->CalculateBoundingBox();
OnModify(); OnModify();
} }
} }
...@@ -297,18 +304,18 @@ EDGE_MODULE* FOOTPRINT_EDIT_FRAME::Begin_Edge_Module( EDGE_MODULE* Edge, ...@@ -297,18 +304,18 @@ EDGE_MODULE* FOOTPRINT_EDIT_FRAME::Begin_Edge_Module( EDGE_MODULE* Edge,
Edge = new EDGE_MODULE( module ); Edge = new EDGE_MODULE( module );
MoveVector.x = MoveVector.y = 0; MoveVector.x = MoveVector.y = 0;
/* Add the new item to the Drawings list head*/ // Add the new item to the Drawings list head
module->m_Drawings.PushFront( Edge ); module->m_Drawings.PushFront( Edge );
/* Update characteristics of the segment or arc. */ // Update characteristics of the segment or arc.
Edge->m_Flags = IS_NEW; Edge->m_Flags = IS_NEW;
Edge->m_Angle = angle; Edge->SetAngle( angle );
Edge->m_Shape = type_edge; Edge->SetShape( type_edge );
if( Edge->m_Shape == S_ARC ) if( Edge->GetShape() == S_ARC )
Edge->m_Angle = ArcValue; Edge->SetAngle( ArcValue );
Edge->m_Width = g_ModuleSegmentWidth; Edge->SetWidth( g_ModuleSegmentWidth );
Edge->SetLayer( module->GetLayer() ); Edge->SetLayer( module->GetLayer() );
if( module->GetLayer() == LAYER_N_FRONT ) if( module->GetLayer() == LAYER_N_FRONT )
...@@ -317,14 +324,14 @@ EDGE_MODULE* FOOTPRINT_EDIT_FRAME::Begin_Edge_Module( EDGE_MODULE* Edge, ...@@ -317,14 +324,14 @@ EDGE_MODULE* FOOTPRINT_EDIT_FRAME::Begin_Edge_Module( EDGE_MODULE* Edge,
if( module->GetLayer() == LAYER_N_BACK ) if( module->GetLayer() == LAYER_N_BACK )
Edge->SetLayer( SILKSCREEN_N_BACK ); Edge->SetLayer( SILKSCREEN_N_BACK );
/* Initialize the starting point of the new segment or arc */ // Initialize the starting point of the new segment or arc
Edge->m_Start = GetScreen()->GetCrossHairPosition(); Edge->SetStart( GetScreen()->GetCrossHairPosition() );
/* Initialize the ending point of the new segment or arc */ // Initialize the ending point of the new segment or arc
Edge->m_End = Edge->m_Start; Edge->SetEnd( Edge->GetStart() );
/* Initialize the relative coordinates */ // Initialize the relative coordinates
Edge->m_Start0 = Edge->m_Start - module->m_Pos; Edge->SetStart0( Edge->GetStart() - module->GetPosition() );
RotatePoint( &Edge->m_Start0, -module->m_Orient ); RotatePoint( &Edge->m_Start0, -module->m_Orient );
...@@ -355,16 +362,20 @@ EDGE_MODULE* FOOTPRINT_EDIT_FRAME::Begin_Edge_Module( EDGE_MODULE* Edge, ...@@ -355,16 +362,20 @@ EDGE_MODULE* FOOTPRINT_EDIT_FRAME::Begin_Edge_Module( EDGE_MODULE* Edge,
Edge = newedge; // point now new item Edge = newedge; // point now new item
Edge->m_Flags = IS_NEW; Edge->m_Flags = IS_NEW;
Edge->m_Width = g_ModuleSegmentWidth; Edge->SetWidth( g_ModuleSegmentWidth );
Edge->m_Start = GetScreen()->GetCrossHairPosition(); Edge->SetStart( GetScreen()->GetCrossHairPosition() );
Edge->m_End = Edge->m_Start; Edge->SetEnd( Edge->GetStart() );
/* Update relative coordinate. */ // Update relative coordinate.
Edge->m_Start0 = Edge->m_Start - module->m_Pos; Edge->SetStart0( Edge->GetStart() - module->GetPosition() );
RotatePoint( &Edge->m_Start0, -module->m_Orient ); wxPoint pt( Edge->GetStart0() );
Edge->m_End0 = Edge->m_Start0; RotatePoint( &pt, -module->GetOrientation() );
Edge->SetStart0( pt );
Edge->SetEnd0( Edge->GetStart0() );
module->CalculateBoundingBox(); module->CalculateBoundingBox();
module->m_LastEdit_Time = time( NULL ); module->m_LastEdit_Time = time( NULL );
...@@ -390,7 +401,7 @@ void FOOTPRINT_EDIT_FRAME::End_Edge_Module( EDGE_MODULE* Edge ) ...@@ -390,7 +401,7 @@ void FOOTPRINT_EDIT_FRAME::End_Edge_Module( EDGE_MODULE* Edge )
Edge->m_Flags = 0; Edge->m_Flags = 0;
/* If last segment length is 0: remove it */ /* If last segment length is 0: remove it */
if( Edge->m_Start == Edge->m_End ) if( Edge->GetStart() == Edge->GetEnd() )
Edge->DeleteStructure(); Edge->DeleteStructure();
} }
......
...@@ -108,7 +108,7 @@ bool PCB_EDIT_FRAME::SetTrackSegmentWidth( TRACK* aTrackItem, ...@@ -108,7 +108,7 @@ bool PCB_EDIT_FRAME::SetTrackSegmentWidth( TRACK* aTrackItem,
{ {
// Set new drill value. Note: currently microvias have only a default drill value // Set new drill value. Note: currently microvias have only a default drill value
if( new_drill > 0 ) if( new_drill > 0 )
aTrackItem->SetDrillValue(new_drill); aTrackItem->SetDrill( new_drill );
else else
aTrackItem->SetDrillDefault(); aTrackItem->SetDrillDefault();
} }
......
...@@ -64,21 +64,23 @@ void PCB_EDIT_FRAME::Place_DrawItem( DRAWSEGMENT* drawitem, wxDC* DC ) ...@@ -64,21 +64,23 @@ void PCB_EDIT_FRAME::Place_DrawItem( DRAWSEGMENT* drawitem, wxDC* DC )
static void Move_Segment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, static void Move_Segment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool aErase ) bool aErase )
{ {
DRAWSEGMENT* Segment = (DRAWSEGMENT*) aPanel->GetScreen()->GetCurItem(); DRAWSEGMENT* segment = (DRAWSEGMENT*) aPanel->GetScreen()->GetCurItem();
if( Segment == NULL ) if( segment == NULL )
return; return;
if( aErase ) if( aErase )
Segment->Draw( aPanel, aDC, GR_XOR ); segment->Draw( aPanel, aDC, GR_XOR );
wxPoint delta; wxPoint delta;
delta = aPanel->GetScreen()->GetCrossHairPosition() - s_LastPosition; delta = aPanel->GetScreen()->GetCrossHairPosition() - s_LastPosition;
Segment->m_Start += delta;
Segment->m_End += delta; segment->SetStart( segment->GetStart() + delta );
segment->SetEnd( segment->GetEnd() + delta );
s_LastPosition = aPanel->GetScreen()->GetCrossHairPosition(); s_LastPosition = aPanel->GetScreen()->GetCrossHairPosition();
Segment->Draw( aPanel, aDC, GR_XOR ); segment->Draw( aPanel, aDC, GR_XOR );
} }
...@@ -221,10 +223,11 @@ DRAWSEGMENT* PCB_EDIT_FRAME::Begin_DrawSegment( DRAWSEGMENT* Segment, int shape, ...@@ -221,10 +223,11 @@ DRAWSEGMENT* PCB_EDIT_FRAME::Begin_DrawSegment( DRAWSEGMENT* Segment, int shape,
SetCurItem( Segment = new DRAWSEGMENT( GetBoard() ) ); SetCurItem( Segment = new DRAWSEGMENT( GetBoard() ) );
Segment->m_Flags = IS_NEW; Segment->m_Flags = IS_NEW;
Segment->SetLayer( getActiveLayer() ); Segment->SetLayer( getActiveLayer() );
Segment->m_Width = s_large; Segment->SetWidth( s_large );
Segment->m_Shape = shape; Segment->SetShape( shape );
Segment->m_Angle = 900; Segment->SetAngle( 900 );
Segment->m_Start = Segment->m_End = GetScreen()->GetCrossHairPosition(); Segment->SetStart( GetScreen()->GetCrossHairPosition() );
Segment->SetEnd( GetScreen()->GetCrossHairPosition() );
DrawPanel->SetMouseCapture( DrawSegment, Abort_EditEdge ); DrawPanel->SetMouseCapture( DrawSegment, Abort_EditEdge );
} }
else /* The ending point ccordinate Segment->m_End was updated by he function else /* The ending point ccordinate Segment->m_End was updated by he function
...@@ -232,11 +235,11 @@ DRAWSEGMENT* PCB_EDIT_FRAME::Begin_DrawSegment( DRAWSEGMENT* Segment, int shape, ...@@ -232,11 +235,11 @@ DRAWSEGMENT* PCB_EDIT_FRAME::Begin_DrawSegment( DRAWSEGMENT* Segment, int shape,
* during the segment creation * during the segment creation
*/ */
{ {
if( Segment->m_Start != Segment->m_End ) if( Segment->GetStart() != Segment->GetEnd() )
{ {
if( Segment->m_Shape == S_SEGMENT ) if( Segment->GetShape() == S_SEGMENT )
{ {
SaveCopyInUndoList(Segment, UR_NEW ); SaveCopyInUndoList( Segment, UR_NEW );
GetBoard()->Add( Segment ); GetBoard()->Add( Segment );
OnModify(); OnModify();
...@@ -250,11 +253,12 @@ DRAWSEGMENT* PCB_EDIT_FRAME::Begin_DrawSegment( DRAWSEGMENT* Segment, int shape, ...@@ -250,11 +253,12 @@ DRAWSEGMENT* PCB_EDIT_FRAME::Begin_DrawSegment( DRAWSEGMENT* Segment, int shape,
Segment->m_Flags = IS_NEW; Segment->m_Flags = IS_NEW;
Segment->SetLayer( DrawItem->GetLayer() ); Segment->SetLayer( DrawItem->GetLayer() );
Segment->m_Width = s_large; Segment->SetWidth( s_large );
Segment->m_Shape = DrawItem->m_Shape; Segment->SetShape( DrawItem->GetShape() );
Segment->m_Type = DrawItem->m_Type; Segment->SetType( DrawItem->GetType() );
Segment->m_Angle = DrawItem->m_Angle; Segment->SetAngle( DrawItem->GetAngle() );
Segment->m_Start = Segment->m_End = DrawItem->m_End; Segment->SetStart( DrawItem->GetEnd() );
Segment->SetEnd( DrawItem->GetEnd() );
DrawSegment( DrawPanel, DC, wxDefaultPosition, false ); DrawSegment( DrawPanel, DC, wxDefaultPosition, false );
} }
else else
...@@ -276,10 +280,10 @@ void PCB_EDIT_FRAME::End_Edge( DRAWSEGMENT* Segment, wxDC* DC ) ...@@ -276,10 +280,10 @@ void PCB_EDIT_FRAME::End_Edge( DRAWSEGMENT* Segment, wxDC* DC )
Segment->Draw( DrawPanel, DC, GR_OR ); Segment->Draw( DrawPanel, DC, GR_OR );
/* Delete if segment length is zero. */ // Delete if segment length is zero.
if( Segment->m_Start == Segment->m_End ) if( Segment->GetStart() == Segment->GetEnd() )
{ {
Segment ->DeleteStructure(); Segment->DeleteStructure();
} }
else else
{ {
...@@ -309,15 +313,18 @@ static void DrawSegment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosi ...@@ -309,15 +313,18 @@ static void DrawSegment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosi
if( aErase ) if( aErase )
Segment->Draw( aPanel, aDC, GR_XOR ); Segment->Draw( aPanel, aDC, GR_XOR );
if( Segments_45_Only && ( Segment->m_Shape == S_SEGMENT ) ) if( Segments_45_Only && Segment->GetShape() == S_SEGMENT )
{ {
wxPoint pt;
CalculateSegmentEndPoint( aPanel->GetScreen()->GetCrossHairPosition(), CalculateSegmentEndPoint( aPanel->GetScreen()->GetCrossHairPosition(),
Segment->m_Start.x, Segment->m_Start.y, Segment->GetStart().x, Segment->GetStart().y,
&Segment->m_End.x, &Segment->m_End.y ); &pt.x, &pt.y );
Segment->SetEnd( pt );
} }
else /* here the angle is arbitrary */ else // here the angle is arbitrary
{ {
Segment->m_End = aPanel->GetScreen()->GetCrossHairPosition(); Segment->SetEnd( aPanel->GetScreen()->GetCrossHairPosition() );
} }
Segment->Draw( aPanel, aDC, GR_XOR ); Segment->Draw( aPanel, aDC, GR_XOR );
......
...@@ -105,7 +105,7 @@ bool PCB_EDIT_FRAME::Other_Layer_Route( TRACK* aTrack, wxDC* DC ) ...@@ -105,7 +105,7 @@ bool PCB_EDIT_FRAME::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
// Usual via is from copper to component. // Usual via is from copper to component.
// layer pair is LAYER_N_BACK and LAYER_N_FRONT. // layer pair is LAYER_N_BACK and LAYER_N_FRONT.
via->SetLayerPair( LAYER_N_BACK, LAYER_N_FRONT ); via->SetLayerPair( LAYER_N_BACK, LAYER_N_FRONT );
via->SetDrillValue( GetBoard()->GetCurrentViaDrill() ); via->SetDrill( GetBoard()->GetCurrentViaDrill() );
int first_layer = getActiveLayer(); int first_layer = getActiveLayer();
int last_layer; int last_layer;
...@@ -117,7 +117,7 @@ bool PCB_EDIT_FRAME::Other_Layer_Route( TRACK* aTrack, wxDC* DC ) ...@@ -117,7 +117,7 @@ bool PCB_EDIT_FRAME::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
last_layer = GetScreen()->m_Route_Layer_BOTTOM; last_layer = GetScreen()->m_Route_Layer_BOTTOM;
/* Adjust the actual via layer pair */ /* Adjust the actual via layer pair */
switch ( via->Shape() ) switch ( via->GetShape() )
{ {
case VIA_BLIND_BURIED: case VIA_BLIND_BURIED:
via->SetLayerPair( first_layer, last_layer ); via->SetLayerPair( first_layer, last_layer );
......
...@@ -891,8 +891,8 @@ static void CreateBoardSection( FILE* aFile, BOARD* aPcb ) ...@@ -891,8 +891,8 @@ static void CreateBoardSection( FILE* aFile, BOARD* aPcb )
{ {
// XXX GenCAD supports arc boundaries but I've seen nothing that reads them // XXX GenCAD supports arc boundaries but I've seen nothing that reads them
fprintf( aFile, "LINE %g %g %g %g\n", fprintf( aFile, "LINE %g %g %g %g\n",
MapXTo( drawseg->m_Start.x ), MapYTo( drawseg->m_Start.y ), MapXTo( drawseg->GetStart().x ), MapYTo( drawseg->GetStart().y ),
MapXTo( drawseg->m_End.x ), MapYTo( drawseg->m_End.y ) ); MapXTo( drawseg->GetEnd().x ), MapYTo( drawseg->GetEnd().y ) );
} }
} }
} }
...@@ -1041,7 +1041,7 @@ static void FootprintWriteShape( FILE* aFile, MODULE* module ) ...@@ -1041,7 +1041,7 @@ static void FootprintWriteShape( FILE* aFile, MODULE* module )
if( PtEdge->GetLayer() == SILKSCREEN_N_FRONT if( PtEdge->GetLayer() == SILKSCREEN_N_FRONT
|| PtEdge->GetLayer() == SILKSCREEN_N_BACK ) || PtEdge->GetLayer() == SILKSCREEN_N_BACK )
{ {
switch( PtEdge->m_Shape ) switch( PtEdge->GetShape() )
{ {
case S_SEGMENT: case S_SEGMENT:
fprintf( aFile, "LINE %g %g %g %g\n", fprintf( aFile, "LINE %g %g %g %g\n",
...@@ -1068,9 +1068,9 @@ static void FootprintWriteShape( FILE* aFile, MODULE* module ) ...@@ -1068,9 +1068,9 @@ static void FootprintWriteShape( FILE* aFile, MODULE* module )
int arcendx, arcendy; int arcendx, arcendy;
arcendx = PtEdge->m_End0.x - PtEdge->m_Start0.x; arcendx = PtEdge->m_End0.x - PtEdge->m_Start0.x;
arcendy = PtEdge->m_End0.y - PtEdge->m_Start0.y; arcendy = PtEdge->m_End0.y - PtEdge->m_Start0.y;
RotatePoint( &arcendx, &arcendy, -PtEdge->m_Angle ); RotatePoint( &arcendx, &arcendy, -PtEdge->GetAngle() );
arcendx += PtEdge->m_Start0.x; arcendx += PtEdge->GetStart0().x;
arcendy += PtEdge->m_Start0.y; arcendy += PtEdge->GetStart0().y;
if( Yaxis_sign == -1 ) if( Yaxis_sign == -1 )
{ {
// Flipping Y flips the arc direction too // Flipping Y flips the arc direction too
...@@ -1078,19 +1078,19 @@ static void FootprintWriteShape( FILE* aFile, MODULE* module ) ...@@ -1078,19 +1078,19 @@ static void FootprintWriteShape( FILE* aFile, MODULE* module )
(arcendx) / SCALE_FACTOR, (arcendx) / SCALE_FACTOR,
(Yaxis_sign * arcendy) / SCALE_FACTOR, (Yaxis_sign * arcendy) / SCALE_FACTOR,
(PtEdge->m_End0.x) / SCALE_FACTOR, (PtEdge->m_End0.x) / SCALE_FACTOR,
(Yaxis_sign * PtEdge->m_End0.y) / SCALE_FACTOR, (Yaxis_sign * PtEdge->GetEnd0().y) / SCALE_FACTOR,
(PtEdge->m_Start0.x) / SCALE_FACTOR, (PtEdge->GetStart0().x) / SCALE_FACTOR,
(Yaxis_sign * PtEdge->m_Start0.y) / SCALE_FACTOR ); (Yaxis_sign * PtEdge->GetStart0().y) / SCALE_FACTOR );
} }
else else
{ {
fprintf( aFile, "ARC %g %g %g %g %g %g\n", fprintf( aFile, "ARC %g %g %g %g %g %g\n",
(PtEdge->m_End0.x) / SCALE_FACTOR, (PtEdge->GetEnd0().x) / SCALE_FACTOR,
(Yaxis_sign * PtEdge->m_End0.y) / SCALE_FACTOR, (Yaxis_sign * PtEdge->GetEnd0().y) / SCALE_FACTOR,
(arcendx) / SCALE_FACTOR, (arcendx) / SCALE_FACTOR,
(Yaxis_sign * arcendy) / SCALE_FACTOR, (Yaxis_sign * arcendy) / SCALE_FACTOR,
(PtEdge->m_Start0.x) / SCALE_FACTOR, (PtEdge->GetStart0().x) / SCALE_FACTOR,
(Yaxis_sign * PtEdge->m_Start0.y) / SCALE_FACTOR ); (Yaxis_sign * PtEdge->GetStart0().y) / SCALE_FACTOR );
} }
break; break;
} }
......
...@@ -593,16 +593,16 @@ static void export_vrml_arc( int layer, double startx, double starty, /*{{{*/ ...@@ -593,16 +593,16 @@ static void export_vrml_arc( int layer, double startx, double starty, /*{{{*/
static void export_vrml_drawsegment( DRAWSEGMENT* drawseg ) /*{{{*/ static void export_vrml_drawsegment( DRAWSEGMENT* drawseg ) /*{{{*/
{ {
int layer = drawseg->GetLayer(); int layer = drawseg->GetLayer();
double w = drawseg->m_Width; double w = drawseg->GetWidth();
double x = drawseg->m_Start.x; double x = drawseg->GetStart().x;
double y = drawseg->m_Start.y; double y = drawseg->GetStart().y;
double xf = drawseg->m_End.x; double xf = drawseg->GetEnd().x;
double yf = drawseg->m_End.y; double yf = drawseg->GetEnd().y;
/* Items on the edge layer are high, not thick */ /* Items on the edge layer are high, not thick */
if( layer == EDGE_N ) if( layer == EDGE_N )
{ {
switch( drawseg->m_Shape ) switch( drawseg->GetShape() )
{ {
/* There is a special 'varc' primitive for this */ /* There is a special 'varc' primitive for this */
case S_ARC: case S_ARC:
...@@ -630,7 +630,7 @@ static void export_vrml_drawsegment( DRAWSEGMENT* drawseg ) /*{{{*/ ...@@ -630,7 +630,7 @@ static void export_vrml_drawsegment( DRAWSEGMENT* drawseg ) /*{{{*/
} }
else else
{ {
switch( drawseg->m_Shape ) switch( drawseg->GetShape() )
{ {
case S_ARC: case S_ARC:
export_vrml_arc( layer, x, y, xf, yf, w, 3 ); export_vrml_arc( layer, x, y, xf, yf, w, 3 );
...@@ -856,13 +856,13 @@ static void export_vrml_text_module( TEXTE_MODULE* module ) /*{{{*/ ...@@ -856,13 +856,13 @@ static void export_vrml_text_module( TEXTE_MODULE* module ) /*{{{*/
static void export_vrml_edge_module( EDGE_MODULE* module ) /*{{{*/ static void export_vrml_edge_module( EDGE_MODULE* module ) /*{{{*/
{ {
int layer = module->GetLayer(); int layer = module->GetLayer();
double x = module->m_Start.x; double x = module->GetStart().x;
double y = module->m_Start.y; double y = module->GetStart().y;
double xf = module->m_End.x; double xf = module->GetEnd().x;
double yf = module->m_End.y; double yf = module->GetEnd().y;
double w = module->m_Width; double w = module->GetWidth();
switch( module->m_Shape ) switch( module->GetShape() )
{ {
case S_ARC: case S_ARC:
export_vrml_arc( layer, x, y, xf, yf, w, 3 ); export_vrml_arc( layer, x, y, xf, yf, w, 3 );
......
...@@ -515,15 +515,15 @@ void WriteDrawSegmentPcb( DRAWSEGMENT* PtDrawSegment, FILE* rptfile ) ...@@ -515,15 +515,15 @@ void WriteDrawSegmentPcb( DRAWSEGMENT* PtDrawSegment, FILE* rptfile )
double radius, width; double radius, width;
char line[1024]; char line[1024];
ux0 = PtDrawSegment->m_Start.x * conv_unit; ux0 = PtDrawSegment->GetStart().x * conv_unit;
uy0 = PtDrawSegment->m_Start.y * conv_unit; uy0 = PtDrawSegment->GetStart().y * conv_unit;
dx = PtDrawSegment->m_End.x * conv_unit; dx = PtDrawSegment->GetEnd().x * conv_unit;
dy = PtDrawSegment->m_End.y * conv_unit; dy = PtDrawSegment->GetEnd().y * conv_unit;
width = PtDrawSegment->m_Width * conv_unit; width = PtDrawSegment->GetWidth() * conv_unit;
switch( PtDrawSegment->m_Shape ) switch( PtDrawSegment->GetShape() )
{ {
case S_CIRCLE: case S_CIRCLE:
radius = hypot( dx - ux0, dy - uy0 ); radius = hypot( dx - ux0, dy - uy0 );
...@@ -536,13 +536,15 @@ void WriteDrawSegmentPcb( DRAWSEGMENT* PtDrawSegment, FILE* rptfile ) ...@@ -536,13 +536,15 @@ void WriteDrawSegmentPcb( DRAWSEGMENT* PtDrawSegment, FILE* rptfile )
case S_ARC: case S_ARC:
{ {
int endx = PtDrawSegment->m_End.x, endy = PtDrawSegment->m_End.y; int endx = PtDrawSegment->GetEnd().x;
int endy = PtDrawSegment->GetEnd().y;
radius = hypot( dx - ux0, dy - uy0 ); radius = hypot( dx - ux0, dy - uy0 );
RotatePoint( &endx, RotatePoint( &endx,
&endy, &endy,
PtDrawSegment->m_Start.x, PtDrawSegment->GetStart().x,
PtDrawSegment->m_Start.y, PtDrawSegment->GetStart().y,
PtDrawSegment->m_Angle ); PtDrawSegment->GetAngle() );
fprintf( rptfile, "$ARC \n" ); fprintf( rptfile, "$ARC \n" );
fprintf( rptfile, "centre %.6lf %.6lf\n", ux0, uy0 ); fprintf( rptfile, "centre %.6lf %.6lf\n", ux0, uy0 );
......
...@@ -158,13 +158,15 @@ bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName ) ...@@ -158,13 +158,15 @@ bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName )
#define TEXT_DEFAULT_SIZE 400 #define TEXT_DEFAULT_SIZE 400
#define OLD_GPCB_UNIT_CONV 10 #define OLD_GPCB_UNIT_CONV 10
#define NEW_GPCB_UNIT_CONV 0.1 #define NEW_GPCB_UNIT_CONV 0.1
FILE* cmpfile; FILE* cmpfile;
double conv_unit = NEW_GPCB_UNIT_CONV; // GPCB unit = 0.01 mils and Pcbnew 0.1 double conv_unit = NEW_GPCB_UNIT_CONV; // GPCB unit = 0.01 mils and Pcbnew 0.1
// Old version unit = 1 mil, so conv_unit is 10 or 0.1 // Old version unit = 1 mil, so conv_unit is 10 or 0.1
bool success = true; bool success = true;
char* Line; char* line;
long ibuf[100]; long ibuf[100];
EDGE_MODULE* DrawSegm; EDGE_MODULE* drawSeg;
D_PAD* Pad; D_PAD* Pad;
wxArrayString params; wxArrayString params;
int iprmcnt, icnt_max, iflgidx; int iprmcnt, icnt_max, iflgidx;
...@@ -178,10 +180,10 @@ bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName ) ...@@ -178,10 +180,10 @@ bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName )
reader.ReadLine(); reader.ReadLine();
Line = reader.Line(); line = reader.Line();
params.Clear(); params.Clear();
Extract_Parameters( params, Line ); Extract_Parameters( params, line );
iprmcnt = 0; iprmcnt = 0;
icnt_max = params.GetCount(); icnt_max = params.GetCount();
...@@ -224,6 +226,7 @@ bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName ) ...@@ -224,6 +226,7 @@ bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName )
iprmcnt++; iprmcnt++;
for( int ii = 0; ii < 20; ii++ ) for( int ii = 0; ii < 20; ii++ )
ibuf[ii] = 0; ibuf[ii] = 0;
for( int ii = 0; ii <= 8; ii++, iprmcnt++ ) // upt to 6 params + terminal char. for( int ii = 0; ii <= 8; ii++, iprmcnt++ ) // upt to 6 params + terminal char.
{ {
if( iprmcnt >= icnt_max ) if( iprmcnt >= icnt_max )
...@@ -265,9 +268,10 @@ bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName ) ...@@ -265,9 +268,10 @@ bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName )
while( reader.ReadLine() ) while( reader.ReadLine() )
{ {
Line = reader.Line(); line = reader.Line();
params.Clear(); params.Clear();
Extract_Parameters( params, Line ); Extract_Parameters( params, line );
if( params.GetCount() > 3 ) // Test units value for a string line param (more than 3 params : ident [ xx ] ) if( params.GetCount() > 3 ) // Test units value for a string line param (more than 3 params : ident [ xx ] )
{ {
if( params[1] == wxT( "(" ) ) if( params[1] == wxT( "(" ) )
...@@ -278,16 +282,14 @@ bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName ) ...@@ -278,16 +282,14 @@ bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName )
if( params[0].CmpNoCase( wxT( "ElementLine" ) ) == 0 ) // line descr if( params[0].CmpNoCase( wxT( "ElementLine" ) ) == 0 ) // line descr
{ // Format: ElementLine [X1 Y1 X2 Y2 Thickness] { // Format: ElementLine [X1 Y1 X2 Y2 Thickness]
DrawSegm = new EDGE_MODULE( this ); wxPoint start0;
DrawSegm->SetLayer( SILKSCREEN_N_FRONT ); wxPoint end0;
DrawSegm->m_Shape = S_SEGMENT; int width;
m_Drawings.PushBack( DrawSegm );
int* list[5] = { int* list[5] = {
&DrawSegm->m_Start0.x, &DrawSegm->m_Start0.y, &start0.x, &start0.y,
&DrawSegm->m_End0.x, &DrawSegm->m_End0.y, &end0.x, &end0.y,
&DrawSegm->m_Width &width
}; };
for( unsigned ii = 0; ii < 5; ii++ ) for( unsigned ii = 0; ii < 5; ii++ )
...@@ -301,18 +303,29 @@ bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName ) ...@@ -301,18 +303,29 @@ bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName )
} }
} }
DrawSegm->SetDrawCoord(); drawSeg = new EDGE_MODULE( this );
drawSeg->SetLayer( SILKSCREEN_N_FRONT );
drawSeg->SetShape( S_SEGMENT );
drawSeg->SetStart0( start0 );
drawSeg->SetEnd0( end0 );
drawSeg->SetWidth( width );
drawSeg->SetDrawCoord();
m_Drawings.PushBack( drawSeg );
continue; continue;
} }
if( params[0].CmpNoCase( wxT( "ElementArc" ) ) == 0 ) // Arc descr if( params[0].CmpNoCase( wxT( "ElementArc" ) ) == 0 ) // Arc descr
{ // format: ElementArc [X Y Width Height StartAngle DeltaAngle Thickness] { // format: ElementArc [X Y Width Height StartAngle DeltaAngle Thickness]
// Pcbnew does know ellipse so we must have Width = Height // Pcbnew does know ellipse so we must have Width = Height
DrawSegm = new EDGE_MODULE( this ); drawSeg = new EDGE_MODULE( this );
DrawSegm->SetLayer( SILKSCREEN_N_FRONT ); drawSeg->SetLayer( SILKSCREEN_N_FRONT );
DrawSegm->m_Shape = S_ARC; drawSeg->SetShape( S_ARC );
m_Drawings.PushBack( DrawSegm ); m_Drawings.PushBack( drawSeg );
for( unsigned ii = 0; ii < 7; ii++ ) for( unsigned ii = 0; ii < 7; ii++ )
{ {
...@@ -328,21 +341,29 @@ bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName ) ...@@ -328,21 +341,29 @@ bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName )
ibuf[ii] = 0; ibuf[ii] = 0;
} }
int radius = (ibuf[2] + ibuf[3]) / 4; // for and arc: ibuf[3] = ibuf[4]. Pcbnew does not know ellipses // for and arc: ibuf[3] = ibuf[4]. Pcbnew does not know ellipses
int radius = (ibuf[2] + ibuf[3]) / 4;
wxPoint centre; wxPoint centre;
centre.x = wxRound( ibuf[0] * conv_unit ); centre.x = wxRound( ibuf[0] * conv_unit );
centre.y = wxRound( ibuf[1] * conv_unit ); centre.y = wxRound( ibuf[1] * conv_unit );
DrawSegm->m_Start0 = centre;
int start_angle = ibuf[4] * 10; // Pcbnew uses 0.1 degrees as units drawSeg->SetStart0( centre );
double start_angle = ibuf[4] * 10; // Pcbnew uses 0.1 degrees as units
start_angle -= 1800; // Use normal X axis as reference start_angle -= 1800; // Use normal X axis as reference
DrawSegm->m_Angle = ibuf[5] * 10; // Angle value is clockwise in gpcb and Pcbnew
DrawSegm->m_End0.x = wxRound( radius * conv_unit ); drawSeg->SetAngle( ibuf[5] * 10 ); // Angle value is clockwise in gpcb and Pcbnew
DrawSegm->m_End0.y = 0;
RotatePoint( &DrawSegm->m_End0, -start_angle );// Calculate start point coordinate of arc drawSeg->SetEnd0( wxPoint( wxRound( radius * conv_unit ), 0 ) );
DrawSegm->m_End0 += centre;
// Calculate start point coordinate of arc
DrawSegm->m_Width = wxRound( ibuf[6] * conv_unit ); wxPoint arcStart( drawSeg->GetEnd0() );
DrawSegm->SetDrawCoord(); RotatePoint( &arcStart, -start_angle );
drawSeg->SetEnd0( centre + arcStart );
drawSeg->SetWidth( wxRound( ibuf[6] * conv_unit ) );
drawSeg->SetDrawCoord();
continue; continue;
} }
......
...@@ -178,13 +178,13 @@ int PCB_BASE_FRAME::ReadListeSegmentDescr( LINE_READER* aReader, ...@@ -178,13 +178,13 @@ int PCB_BASE_FRAME::ReadListeSegmentDescr( LINE_READER* aReader,
if( arg_count < 7 || drill <= 0 ) if( arg_count < 7 || drill <= 0 )
newTrack->SetDrillDefault(); newTrack->SetDrillDefault();
else else
newTrack->SetDrillValue( drill ); newTrack->SetDrill( drill );
newTrack->SetLayer( layer ); newTrack->SetLayer( layer );
if( makeType == PCB_VIA_T ) // Ensure layers are OK when possible: if( makeType == PCB_VIA_T ) // Ensure layers are OK when possible:
{ {
if( newTrack->Shape() == VIA_THROUGH ) if( newTrack->GetShape() == VIA_THROUGH )
( (SEGVIA*) newTrack )->SetLayerPair( LAYER_N_FRONT, LAYER_N_BACK ); ( (SEGVIA*) newTrack )->SetLayerPair( LAYER_N_FRONT, LAYER_N_BACK );
} }
...@@ -857,6 +857,8 @@ bool WriteSheetDescr( BASE_SCREEN* screen, FILE* File ) ...@@ -857,6 +857,8 @@ bool WriteSheetDescr( BASE_SCREEN* screen, FILE* File )
} }
#if !defined( USE_NEW_PCBNEW_LOAD )
static bool ReadSheetDescr( BASE_SCREEN* screen, LINE_READER* aReader ) static bool ReadSheetDescr( BASE_SCREEN* screen, LINE_READER* aReader )
{ {
char buf[1024]; char buf[1024];
...@@ -963,8 +965,6 @@ static bool ReadSheetDescr( BASE_SCREEN* screen, LINE_READER* aReader ) ...@@ -963,8 +965,6 @@ static bool ReadSheetDescr( BASE_SCREEN* screen, LINE_READER* aReader )
} }
#if !defined( USE_NEW_PCBNEW_LOAD )
int PCB_EDIT_FRAME::ReadPcbFile( LINE_READER* aReader, bool Append ) int PCB_EDIT_FRAME::ReadPcbFile( LINE_READER* aReader, bool Append )
{ {
wxBusyCursor dummy; wxBusyCursor dummy;
...@@ -975,8 +975,6 @@ int PCB_EDIT_FRAME::ReadPcbFile( LINE_READER* aReader, bool Append ) ...@@ -975,8 +975,6 @@ int PCB_EDIT_FRAME::ReadPcbFile( LINE_READER* aReader, bool Append )
BOARD* board = GetBoard(); BOARD* board = GetBoard();
NbDraw = NbTrack = NbZone = NbMod = NbNets = -1;
board->m_Status_Pcb = 0; board->m_Status_Pcb = 0;
board->m_NetClasses.Clear(); board->m_NetClasses.Clear();
......
...@@ -148,15 +148,15 @@ bool DRAWSEGMENT::Save( FILE* aFile ) const ...@@ -148,15 +148,15 @@ bool DRAWSEGMENT::Save( FILE* aFile ) const
if( m_Type != S_CURVE ) if( m_Type != S_CURVE )
{ {
fprintf( aFile, "De %d %d %d %lX %X\n", fprintf( aFile, "De %d %d %g %lX %X\n",
m_Layer, m_Type, m_Angle, m_Layer, m_Type, GetAngle(),
m_TimeStamp, ReturnStatus() ); m_TimeStamp, GetStatus() );
} }
else else
{ {
fprintf( aFile, "De %d %d %d %lX %X %d %d %d %d\n", fprintf( aFile, "De %d %d %g %lX %X %d %d %d %d\n",
m_Layer, m_Type, m_Angle, m_Layer, m_Type, GetAngle(),
m_TimeStamp, ReturnStatus(), m_TimeStamp, GetStatus(),
m_BezierC1.x,m_BezierC1.y, m_BezierC1.x,m_BezierC1.y,
m_BezierC2.x,m_BezierC2.y); m_BezierC2.x,m_BezierC2.y);
} }
...@@ -437,8 +437,8 @@ bool TEXTE_PCB::Save( FILE* aFile ) const ...@@ -437,8 +437,8 @@ bool TEXTE_PCB::Save( FILE* aFile ) const
delete list; delete list;
fprintf( aFile, "Po %d %d %d %d %d %d\n", fprintf( aFile, "Po %d %d %d %d %d %g\n",
m_Pos.x, m_Pos.y, m_Size.x, m_Size.y, m_Thickness, m_Orient ); m_Pos.x, m_Pos.y, m_Size.x, m_Size.y, m_Thickness, GetOrientation() );
char hJustify = 'L'; char hJustify = 'L';
switch( m_HJustify ) switch( m_HJustify )
...@@ -521,10 +521,10 @@ bool EDGE_MODULE::Save( FILE* aFile ) const ...@@ -521,10 +521,10 @@ bool EDGE_MODULE::Save( FILE* aFile ) const
break; break;
case S_ARC: case S_ARC:
ret = fprintf( aFile, "DA %d %d %d %d %d %d %d\n", ret = fprintf( aFile, "DA %d %d %d %d %g %d %d\n",
m_Start0.x, m_Start0.y, m_Start0.x, m_Start0.y,
m_End0.x, m_End0.y, m_End0.x, m_End0.y,
m_Angle, GetAngle(),
m_Width, m_Layer ); m_Width, m_Layer );
break; break;
...@@ -565,7 +565,7 @@ bool TRACK::Save( FILE* aFile ) const ...@@ -565,7 +565,7 @@ bool TRACK::Save( FILE* aFile ) const
fprintf( aFile, "De %d %d %d %lX %X\n", fprintf( aFile, "De %d %d %d %lX %X\n",
m_Layer, type, GetNet(), m_Layer, type, GetNet(),
m_TimeStamp, ReturnStatus() ); m_TimeStamp, GetStatus() );
return true; return true;
} }
...@@ -587,16 +587,16 @@ bool DIMENSION::Save( FILE* aFile ) const ...@@ -587,16 +587,16 @@ bool DIMENSION::Save( FILE* aFile ) const
fprintf( aFile, "Va %d\n", m_Value ); fprintf( aFile, "Va %d\n", m_Value );
if( !m_Text->m_Text.IsEmpty() ) if( !m_Text.GetText().IsEmpty() )
fprintf( aFile, "Te %s\n", EscapedUTF8( m_Text->m_Text ).c_str() ); fprintf( aFile, "Te %s\n", EscapedUTF8( m_Text.GetText() ).c_str() );
else else
fprintf( aFile, "Te \"?\"\n" ); fprintf( aFile, "Te \"?\"\n" );
fprintf( aFile, "Po %d %d %d %d %d %d %d\n", fprintf( aFile, "Po %d %d %d %d %d %g %d\n",
m_Text->m_Pos.x, m_Text->m_Pos.y, m_Text.m_Pos.x, m_Text.m_Pos.y,
m_Text->m_Size.x, m_Text->m_Size.y, m_Text.m_Size.x, m_Text.m_Size.y,
m_Text->GetThickness(), m_Text->GetOrientation(), m_Text.GetThickness(), m_Text.GetOrientation(),
m_Text->m_Mirror ? 0 : 1 ); m_Text.m_Mirror ? 0 : 1 );
fprintf( aFile, "Sb %d %d %d %d %d %d\n", S_SEGMENT, fprintf( aFile, "Sb %d %d %d %d %d %d\n", S_SEGMENT,
m_crossBarOx, m_crossBarOy, m_crossBarOx, m_crossBarOy,
...@@ -747,9 +747,9 @@ bool MODULE::Save( FILE* aFile ) const ...@@ -747,9 +747,9 @@ bool MODULE::Save( FILE* aFile ) const
else else
statusTxt[1] = '~'; statusTxt[1] = '~';
fprintf( aFile, "Po %d %d %d %d %8.8lX %8.8lX %s\n", fprintf( aFile, "Po %d %d %g %d %8.8lX %8.8lX %s\n",
m_Pos.x, m_Pos.y, m_Pos.x, m_Pos.y,
m_Orient, m_Layer, m_LastEdit_Time, GetOrientation(), m_Layer, m_LastEdit_Time,
m_TimeStamp, statusTxt ); m_TimeStamp, statusTxt );
fprintf( aFile, "Li %s\n", TO_UTF8( m_LibRef ) ); fprintf( aFile, "Li %s\n", TO_UTF8( m_LibRef ) );
...@@ -1158,12 +1158,15 @@ int MODULE::ReadDescr( LINE_READER* aReader ) ...@@ -1158,12 +1158,15 @@ int MODULE::ReadDescr( LINE_READER* aReader )
switch( Line[0] ) switch( Line[0] )
{ {
case 'P': case 'P':
double orientation;
memset( BufCar1, 0, sizeof(BufCar1) ); memset( BufCar1, 0, sizeof(BufCar1) );
sscanf( PtLine, "%d %d %d %d %lX %lX %s", sscanf( PtLine, "%d %d %lf %d %lX %lX %s",
&m_Pos.x, &m_Pos.y, &m_Pos.x, &m_Pos.y,
&m_Orient, &m_Layer, &orientation, &m_Layer,
&m_LastEdit_Time, &m_TimeStamp, BufCar1 ); &m_LastEdit_Time, &m_TimeStamp, BufCar1 );
SetOrientation( orientation );
m_ModuleStatus = 0; m_ModuleStatus = 0;
if( BufCar1[0] == 'F' ) if( BufCar1[0] == 'F' )
...@@ -1331,11 +1334,14 @@ int EDGE_MODULE::ReadDescr( LINE_READER* aReader ) ...@@ -1331,11 +1334,14 @@ int EDGE_MODULE::ReadDescr( LINE_READER* aReader )
switch( m_Shape ) switch( m_Shape )
{ {
case S_ARC: case S_ARC:
sscanf( Line + 3, "%d %d %d %d %d %d %d", double angle;
sscanf( Line + 3, "%d %d %d %d %lf %d %d",
&m_Start0.x, &m_Start0.y, &m_Start0.x, &m_Start0.y,
&m_End0.x, &m_End0.y, &m_End0.x, &m_End0.y,
&m_Angle, &m_Width, &m_Layer ); &angle, &m_Width, &m_Layer );
NORMALIZE_ANGLE_360( m_Angle );
NORMALIZE_ANGLE_360( angle );
SetAngle( angle );
break; break;
case S_SEGMENT: case S_SEGMENT:
...@@ -1441,14 +1447,14 @@ bool DIMENSION::ReadDimensionDescr( LINE_READER* aReader ) ...@@ -1441,14 +1447,14 @@ bool DIMENSION::ReadDimensionDescr( LINE_READER* aReader )
layer = LAST_NO_COPPER_LAYER; layer = LAST_NO_COPPER_LAYER;
SetLayer( layer ); SetLayer( layer );
m_Text->SetLayer( layer ); m_Text.SetLayer( layer );
continue; continue;
} }
if( Line[0] == 'T' ) if( Line[0] == 'T' )
{ {
ReadDelimitedText( Text, Line + 2, sizeof(Text) ); ReadDelimitedText( Text, Line + 2, sizeof(Text) );
m_Text->m_Text = FROM_UTF8( Text ); m_Text.m_Text = FROM_UTF8( Text );
continue; continue;
} }
...@@ -1458,15 +1464,15 @@ bool DIMENSION::ReadDimensionDescr( LINE_READER* aReader ) ...@@ -1458,15 +1464,15 @@ bool DIMENSION::ReadDimensionDescr( LINE_READER* aReader )
int orientation; int orientation;
int thickness; int thickness;
sscanf( Line + 2, " %d %d %d %d %d %d %d", sscanf( Line + 2, " %d %d %d %d %d %d %d",
&m_Text->m_Pos.x, &m_Text->m_Pos.y, &m_Text.m_Pos.x, &m_Text.m_Pos.y,
&m_Text->m_Size.x, &m_Text->m_Size.y, &m_Text.m_Size.x, &m_Text.m_Size.y,
&thickness, &orientation, &thickness, &orientation,
&normal_display ); &normal_display );
m_Text->m_Mirror = normal_display ? false : true; m_Text.m_Mirror = normal_display ? false : true;
m_Pos = m_Text->m_Pos; m_Pos = m_Text.m_Pos;
m_Text->SetOrientation( orientation ); m_Text.SetOrientation( orientation );
m_Text->SetThickness( thickness ); m_Text.SetThickness( thickness );
continue; continue;
} }
...@@ -1580,7 +1586,9 @@ bool DRAWSEGMENT::ReadDrawSegmentDescr( LINE_READER* aReader ) ...@@ -1580,7 +1586,9 @@ bool DRAWSEGMENT::ReadDrawSegmentDescr( LINE_READER* aReader )
sscanf( token,"%d",&m_Type ); sscanf( token,"%d",&m_Type );
break; break;
case 2: case 2:
sscanf( token,"%d",&m_Angle ); double angle;
sscanf( token, "%lf", &angle );
SetAngle( angle );
break; break;
case 3: case 3:
sscanf( token,"%lX",&m_TimeStamp ); sscanf( token,"%lX",&m_TimeStamp );
...@@ -2062,9 +2070,12 @@ int TEXTE_PCB::ReadTextePcbDescr( LINE_READER* aReader ) ...@@ -2062,9 +2070,12 @@ int TEXTE_PCB::ReadTextePcbDescr( LINE_READER* aReader )
} }
if( strncmp( line, "Po", 2 ) == 0 ) if( strncmp( line, "Po", 2 ) == 0 )
{ {
sscanf( line + 2, " %d %d %d %d %d %d", double angle;
sscanf( line + 2, " %d %d %d %d %d %lf",
&m_Pos.x, &m_Pos.y, &m_Size.x, &m_Size.y, &m_Pos.x, &m_Pos.y, &m_Size.x, &m_Size.y,
&m_Thickness, &m_Orient ); &m_Thickness, &angle );
SetOrientation( angle );
// Ensure the text has minimal size to see this text on screen: // Ensure the text has minimal size to see this text on screen:
if( m_Size.x < 5 ) if( m_Size.x < 5 )
...@@ -2135,6 +2146,7 @@ int TEXTE_MODULE::ReadDescr( LINE_READER* aReader ) ...@@ -2135,6 +2146,7 @@ int TEXTE_MODULE::ReadDescr( LINE_READER* aReader )
int type; int type;
char BufCar1[128], BufCar2[128], BufCar3[128]; char BufCar1[128], BufCar2[128], BufCar3[128];
char* line = aReader->Line(); char* line = aReader->Line();
double angle;
int layer = SILKSCREEN_N_FRONT; int layer = SILKSCREEN_N_FRONT;
...@@ -2142,16 +2154,19 @@ int TEXTE_MODULE::ReadDescr( LINE_READER* aReader ) ...@@ -2142,16 +2154,19 @@ int TEXTE_MODULE::ReadDescr( LINE_READER* aReader )
BufCar2[0] = 0; BufCar2[0] = 0;
BufCar3[0] = 0; BufCar3[0] = 0;
if( sscanf( line + 1, "%d %d %d %d %d %d %d %s %s %d %s", if( sscanf( line + 1, "%d %d %d %d %d %lf %d %s %s %d %s",
&type, &type,
&m_Pos0.x, &m_Pos0.y, &m_Pos0.x, &m_Pos0.y,
&m_Size.y, &m_Size.x, &m_Size.y, &m_Size.x,
&m_Orient, &m_Thickness, &angle, &m_Thickness,
BufCar1, BufCar2, &layer, BufCar3 ) >= 10 ) BufCar1, BufCar2, &layer, BufCar3 ) >= 10 )
{ {
success = true; success = true;
SetOrientation( angle );
} }
if( (type != TEXT_is_REFERENCE) && (type != TEXT_is_VALUE) ) if( (type != TEXT_is_REFERENCE) && (type != TEXT_is_VALUE) )
type = TEXT_is_DIVERS; type = TEXT_is_DIVERS;
......
This diff is collapsed.
...@@ -83,12 +83,6 @@ protected: ...@@ -83,12 +83,6 @@ protected:
/// initialize PLUGIN like a constructor would, and futz with fresh BOARD if needed. /// initialize PLUGIN like a constructor would, and futz with fresh BOARD if needed.
void init( PROPERTIES* aProperties ); void init( PROPERTIES* aProperties );
int NbDraw;
int NbTrack;
int NbZone;
int NbMod;
int NbNets;
double biuToDisk; ///< convert from BIUs to disk engineering units with this scale factor double biuToDisk; ///< convert from BIUs to disk engineering units with this scale factor
double diskToBiu; ///< convert from disk engineering units to BIUs with this scale factor double diskToBiu; ///< convert from disk engineering units to BIUs with this scale factor
...@@ -135,9 +129,9 @@ protected: ...@@ -135,9 +129,9 @@ protected:
void load3D( MODULE* aModule ); void load3D( MODULE* aModule );
void loadPAD( MODULE* aModule ); void loadPAD( MODULE* aModule );
void loadMODULE_TEXT( TEXTE_MODULE* aText ); void loadMODULE_TEXT( TEXTE_MODULE* aText );
void loadEDGE_MODULE( MODULE* aModule ); void loadMODULE_EDGE( MODULE* aModule );
void loadDRAWSEGMENT(); void loadPCB_LINE();
void loadNETINFO_ITEM(); void loadNETINFO_ITEM();
void loadPCB_TEXT(); void loadPCB_TEXT();
void loadNETCLASS(); void loadNETCLASS();
...@@ -206,17 +200,11 @@ protected: ...@@ -206,17 +200,11 @@ protected:
void saveNETCLASS( const NETCLASS* aNetclass ) const; void saveNETCLASS( const NETCLASS* aNetclass ) const;
void savePCB_TEXT( const TEXTE_PCB* aText ) const; void savePCB_TEXT( const TEXTE_PCB* aText ) const;
void saveEDGE_MODULE( const EDGE_MODULE* aEdge ) const; void savePCB_TARGET( const PCB_TARGET* aTarget ) const;
void saveTARGET( const PCB_TARGET* aTarget ) const; void savePCB_LINE( const DRAWSEGMENT* aStroke ) const;
void saveDIMENTION( const DIMENSION* aDimension ) const; void saveDIMENTION( const DIMENSION* aDimension ) const;
void saveTRACK( const TRACK* aTrack ) const; void saveTRACK( const TRACK* aTrack ) const;
/**
* Function saveSEGZONE
* saves the oldschool zones, now outdated in favor of polygon zones.
*/
void saveSEGZONE( const SEGZONE* aZone ) const;
/** /**
* Function saveZONE_CONTAINER * Function saveZONE_CONTAINER
* saves the new polygon zones. * saves the new polygon zones.
......
...@@ -102,13 +102,13 @@ TARGET_PROPERTIES_DIALOG_EDITOR::TARGET_PROPERTIES_DIALOG_EDITOR( PCB_EDIT_FRAME ...@@ -102,13 +102,13 @@ TARGET_PROPERTIES_DIALOG_EDITOR::TARGET_PROPERTIES_DIALOG_EDITOR( PCB_EDIT_FRAME
// Size: // Size:
m_MireSizeCtrl = new EDA_VALUE_CTRL( this, _( "Size" ), m_MireSizeCtrl = new EDA_VALUE_CTRL( this, _( "Size" ),
m_Target->m_Size, m_Target->GetSize(),
g_UserUnit, LeftBoxSizer, g_UserUnit, LeftBoxSizer,
m_Parent->m_InternalUnits ); m_Parent->m_InternalUnits );
// Width: // Width:
m_MireWidthCtrl = new EDA_VALUE_CTRL( this, _( "Width" ), m_MireWidthCtrl = new EDA_VALUE_CTRL( this, _( "Width" ),
m_Target->m_Width, m_Target->GetWidth(),
g_UserUnit, LeftBoxSizer, g_UserUnit, LeftBoxSizer,
m_Parent->m_InternalUnits ); m_Parent->m_InternalUnits );
...@@ -118,7 +118,7 @@ TARGET_PROPERTIES_DIALOG_EDITOR::TARGET_PROPERTIES_DIALOG_EDITOR( PCB_EDIT_FRAME ...@@ -118,7 +118,7 @@ TARGET_PROPERTIES_DIALOG_EDITOR::TARGET_PROPERTIES_DIALOG_EDITOR( PCB_EDIT_FRAME
_( "Target Shape:" ), _( "Target Shape:" ),
wxDefaultPosition, wxSize( -1, -1 ), wxDefaultPosition, wxSize( -1, -1 ),
2, shape_list, 1 ); 2, shape_list, 1 );
m_MireShape->SetSelection( m_Target->m_Shape ? 1 : 0 ); m_MireShape->SetSelection( m_Target->GetShape() ? 1 : 0 );
LeftBoxSizer->Add( m_MireShape, 0, wxGROW | wxALL, 5 ); LeftBoxSizer->Add( m_MireShape, 0, wxGROW | wxALL, 5 );
GetSizer()->Fit( this ); GetSizer()->Fit( this );
...@@ -146,9 +146,10 @@ void TARGET_PROPERTIES_DIALOG_EDITOR::OnOkClick( wxCommandEvent& event ) ...@@ -146,9 +146,10 @@ void TARGET_PROPERTIES_DIALOG_EDITOR::OnOkClick( wxCommandEvent& event )
m_Target->m_Flags |= IN_EDIT; // set flag in edit to force m_Target->m_Flags |= IN_EDIT; // set flag in edit to force
// undo/redo/abort proper operation // undo/redo/abort proper operation
m_Target->m_Width = m_MireWidthCtrl->GetValue(); m_Target->SetWidth( m_MireWidthCtrl->GetValue() );
MireDefaultSize = m_Target->m_Size = m_MireSizeCtrl->GetValue(); MireDefaultSize = m_MireSizeCtrl->GetValue();
m_Target->m_Shape = m_MireShape->GetSelection() ? 1 : 0; m_Target->SetSize( m_MireSizeCtrl->GetValue() );
m_Target->SetShape( m_MireShape->GetSelection() ? 1 : 0 );
m_Target->Draw( m_Parent->DrawPanel, m_DC, ( m_Target->m_Flags & IS_MOVED ) ? GR_XOR : GR_OR ); m_Target->Draw( m_Parent->DrawPanel, m_DC, ( m_Target->m_Flags & IS_MOVED ) ? GR_XOR : GR_OR );
...@@ -188,14 +189,14 @@ static void AbortMoveAndEditTarget( EDA_DRAW_PANEL* Panel, wxDC* DC ) ...@@ -188,14 +189,14 @@ static void AbortMoveAndEditTarget( EDA_DRAW_PANEL* Panel, wxDC* DC )
target->DeleteStructure(); target->DeleteStructure();
target = NULL; target = NULL;
} }
else /* it is an existing item: retrieve initial values of parameters */ else // it is an existing item: retrieve initial values of parameters
{ {
if( ( target->m_Flags & (IN_EDIT | IS_MOVED) ) ) if( ( target->m_Flags & (IN_EDIT | IS_MOVED) ) )
{ {
target->m_Pos = s_TargetCopy.m_Pos; target->SetPosition( s_TargetCopy.GetPosition() );
target->m_Width = s_TargetCopy.m_Width; target->SetWidth( s_TargetCopy.GetWidth() );
target->m_Size = s_TargetCopy.m_Size; target->SetSize( s_TargetCopy.GetSize() );
target->m_Shape = s_TargetCopy.m_Shape; target->SetShape( s_TargetCopy.GetShape() );
} }
target->m_Flags = 0; target->m_Flags = 0;
target->Draw( Panel, DC, GR_OR ); target->Draw( Panel, DC, GR_OR );
...@@ -214,9 +215,9 @@ PCB_TARGET* PCB_EDIT_FRAME::CreateTarget( wxDC* DC ) ...@@ -214,9 +215,9 @@ PCB_TARGET* PCB_EDIT_FRAME::CreateTarget( wxDC* DC )
GetBoard()->Add( target ); GetBoard()->Add( target );
target->SetLayer( EDGE_N ); target->SetLayer( EDGE_N );
target->m_Width = GetBoard()->GetDesignSettings().m_EdgeSegmentWidth; target->SetWidth( GetBoard()->GetDesignSettings().m_EdgeSegmentWidth );
target->m_Size = MireDefaultSize; target->SetSize( MireDefaultSize );
target->m_Pos = DrawPanel->GetScreen()->GetCrossHairPosition(); target->SetPosition( DrawPanel->GetScreen()->GetCrossHairPosition() );
PlaceTarget( target, DC ); PlaceTarget( target, DC );
...@@ -257,7 +258,7 @@ void PCB_EDIT_FRAME::PlaceTarget( PCB_TARGET* aTarget, wxDC* DC ) ...@@ -257,7 +258,7 @@ void PCB_EDIT_FRAME::PlaceTarget( PCB_TARGET* aTarget, wxDC* DC )
if( aTarget->m_Flags == IS_MOVED ) if( aTarget->m_Flags == IS_MOVED )
{ {
SaveCopyInUndoList( aTarget, UR_MOVED, aTarget->m_Pos - s_TargetCopy.m_Pos ); SaveCopyInUndoList( aTarget, UR_MOVED, aTarget->GetPosition() - s_TargetCopy.GetPosition() );
aTarget->m_Flags = 0; aTarget->m_Flags = 0;
return; return;
} }
...@@ -286,7 +287,7 @@ static void ShowTargetShapeWhileMovingMouse( EDA_DRAW_PANEL* aPanel, wxDC* aDC, ...@@ -286,7 +287,7 @@ static void ShowTargetShapeWhileMovingMouse( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
if( aErase ) if( aErase )
target->Draw( aPanel, aDC, GR_XOR ); target->Draw( aPanel, aDC, GR_XOR );
target->m_Pos = screen->GetCrossHairPosition(); target->SetPosition( screen->GetCrossHairPosition() );
target->Draw( aPanel, aDC, GR_XOR ); target->Draw( aPanel, aDC, GR_XOR );
} }
...@@ -696,17 +696,17 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -696,17 +696,17 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
void FOOTPRINT_EDIT_FRAME::Transform( MODULE* module, int transform ) void FOOTPRINT_EDIT_FRAME::Transform( MODULE* module, int transform )
{ {
D_PAD* pad = module->m_Pads; D_PAD* pad = module->m_Pads;
EDA_ITEM* PtStruct = module->m_Drawings; EDA_ITEM* item = module->m_Drawings;
TEXTE_MODULE* textmod; TEXTE_MODULE* textmod;
EDGE_MODULE* edgemod; EDGE_MODULE* edgemod;
int angle = 900; // Necessary +- 900 (+- 90 degrees) ) double angle = 900; // Necessary +- 900 (+- 90 degrees) )
switch( transform ) switch( transform )
{ {
case ID_MODEDIT_MODULE_ROTATE: case ID_MODEDIT_MODULE_ROTATE:
module->SetOrientation( angle ); module->SetOrientation( angle );
for( ; pad != NULL; pad = (D_PAD*) pad->Next() ) for( ; pad; pad = pad->Next() )
{ {
pad->SetPos0( pad->m_Pos ); pad->SetPos0( pad->m_Pos );
pad->m_Orient -= angle; pad->m_Orient -= angle;
...@@ -727,18 +727,18 @@ void FOOTPRINT_EDIT_FRAME::Transform( MODULE* module, int transform ) ...@@ -727,18 +727,18 @@ void FOOTPRINT_EDIT_FRAME::Transform( MODULE* module, int transform )
if( module->m_Value->m_Orient >= 1800 ) if( module->m_Value->m_Orient >= 1800 )
module->m_Value->m_Orient -= 1800; module->m_Value->m_Orient -= 1800;
for( ; PtStruct != NULL; PtStruct = PtStruct->Next() ) for( ; item != NULL; item = item->Next() )
{ {
if( PtStruct->Type() == PCB_MODULE_EDGE_T ) if( item->Type() == PCB_MODULE_EDGE_T )
{ {
edgemod = (EDGE_MODULE*) PtStruct; edgemod = (EDGE_MODULE*) item;
edgemod->m_Start0 = edgemod->m_Start; edgemod->SetStart0( edgemod->GetStart() );
edgemod->m_End0 = edgemod->m_End; edgemod->SetEnd0( edgemod->GetEnd() );
} }
if( PtStruct->Type() == PCB_MODULE_TEXT_T ) else if( item->Type() == PCB_MODULE_TEXT_T )
{ {
textmod = (TEXTE_MODULE*) PtStruct; textmod = (TEXTE_MODULE*) item;
textmod->SetPos0( textmod->m_Pos ); textmod->SetPos0( textmod->m_Pos );
} }
} }
...@@ -758,7 +758,7 @@ void FOOTPRINT_EDIT_FRAME::Transform( MODULE* module, int transform ) ...@@ -758,7 +758,7 @@ void FOOTPRINT_EDIT_FRAME::Transform( MODULE* module, int transform )
pad->m_Orient = 3600 - pad->m_Orient; pad->m_Orient = 3600 - pad->m_Orient;
} }
/* Reverse mirror of reference. */ // Reverse mirror of reference.
textmod = module->m_Reference; textmod = module->m_Reference;
NEGATE( textmod->m_Pos.y ); NEGATE( textmod->m_Pos.y );
NEGATE( textmod->m_Pos0.y ); NEGATE( textmod->m_Pos0.y );
...@@ -766,7 +766,7 @@ void FOOTPRINT_EDIT_FRAME::Transform( MODULE* module, int transform ) ...@@ -766,7 +766,7 @@ void FOOTPRINT_EDIT_FRAME::Transform( MODULE* module, int transform )
if( textmod->m_Orient ) if( textmod->m_Orient )
textmod->m_Orient = 3600 - textmod->m_Orient; textmod->m_Orient = 3600 - textmod->m_Orient;
/* Reverse mirror of value. */ // Reverse mirror of value.
textmod = module->m_Value; textmod = module->m_Value;
NEGATE( textmod->m_Pos.y ); NEGATE( textmod->m_Pos.y );
NEGATE( textmod->m_Pos0.y ); NEGATE( textmod->m_Pos0.y );
...@@ -774,26 +774,28 @@ void FOOTPRINT_EDIT_FRAME::Transform( MODULE* module, int transform ) ...@@ -774,26 +774,28 @@ void FOOTPRINT_EDIT_FRAME::Transform( MODULE* module, int transform )
if( textmod->m_Orient ) if( textmod->m_Orient )
textmod->m_Orient = 3600 - textmod->m_Orient; textmod->m_Orient = 3600 - textmod->m_Orient;
/* Reverse mirror of footprints. */ // Reverse mirror of footprints.
PtStruct = module->m_Drawings; item = module->m_Drawings;
for( ; PtStruct != NULL; PtStruct = PtStruct->Next() ) for( ; item; item = item->Next() )
{ {
switch( PtStruct->Type() ) switch( item->Type() )
{ {
case PCB_MODULE_EDGE_T: case PCB_MODULE_EDGE_T:
edgemod = (EDGE_MODULE*) PtStruct; edgemod = (EDGE_MODULE*) item;
NEGATE( edgemod->m_Start.y );
NEGATE( edgemod->m_End.y ); edgemod->SetStartY( -edgemod->GetStart().y );
/* Invert local coordinates */ edgemod->SetEndY( -edgemod->GetEnd().y );
// Invert local coordinates
NEGATE( edgemod->m_Start0.y ); NEGATE( edgemod->m_Start0.y );
NEGATE( edgemod->m_End0.y ); NEGATE( edgemod->m_End0.y );
NEGATE( edgemod->m_Angle ); edgemod->SetAngle( -edgemod->GetAngle() );
break; break;
case PCB_MODULE_TEXT_T: case PCB_MODULE_TEXT_T:
/* Reverse mirror position and mirror. */ // Reverse mirror position and mirror.
textmod = (TEXTE_MODULE*) PtStruct; textmod = (TEXTE_MODULE*) item;
NEGATE( textmod->m_Pos.y ); NEGATE( textmod->m_Pos.y );
NEGATE( textmod->m_Pos0.y ); NEGATE( textmod->m_Pos0.y );
......
...@@ -92,19 +92,19 @@ void FOOTPRINT_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -92,19 +92,19 @@ void FOOTPRINT_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
} }
else if( item->IsNew() ) else if( item->IsNew() )
{ {
if( ( (EDGE_MODULE*) item )->m_Shape == S_CIRCLE ) if( ( (EDGE_MODULE*) item )->GetShape() == S_CIRCLE )
{ {
End_Edge_Module( (EDGE_MODULE*) item ); End_Edge_Module( (EDGE_MODULE*) item );
SetCurItem( NULL ); SetCurItem( NULL );
DrawPanel->Refresh(); DrawPanel->Refresh();
} }
else if( ( (EDGE_MODULE*) item )->m_Shape == S_ARC ) else if( ( (EDGE_MODULE*) item )->GetShape() == S_ARC )
{ {
End_Edge_Module( (EDGE_MODULE*) item ); End_Edge_Module( (EDGE_MODULE*) item );
SetCurItem( NULL ); SetCurItem( NULL );
DrawPanel->Refresh(); DrawPanel->Refresh();
} }
else if( ( (EDGE_MODULE*) item )->m_Shape == S_SEGMENT ) else if( ( (EDGE_MODULE*) item )->GetShape() == S_SEGMENT )
{ {
SetCurItem( Begin_Edge_Module( (EDGE_MODULE*) item, DC, 0 ) ); SetCurItem( Begin_Edge_Module( (EDGE_MODULE*) item, DC, 0 ) );
} }
......
This diff is collapsed.
This diff is collapsed.
...@@ -69,7 +69,8 @@ TRACK* LocateIntrusion( TRACK* listStart, TRACK* aTrack, int aLayer, const wxPoi ...@@ -69,7 +69,8 @@ TRACK* LocateIntrusion( TRACK* listStart, TRACK* aTrack, int aLayer, const wxPoi
void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool aErase ); bool aErase );
/* Determine coordinate for a segment direction of 0, 90 or 45 degrees, /**
* Determine coordinate for a segment direction of 0, 90 or 45 degrees,
* depending on it's position from the origin (ox, oy) and \a aPosiition.. * depending on it's position from the origin (ox, oy) and \a aPosiition..
*/ */
void CalculateSegmentEndPoint( const wxPoint& aPosition, int ox, int oy, int* fx, int* fy ); void CalculateSegmentEndPoint( const wxPoint& aPosition, int ox, int oy, int* fx, int* fy );
......
...@@ -212,13 +212,24 @@ static DRAWSEGMENT* findPoint( const wxPoint& aPoint, TYPE_COLLECTOR* items ) ...@@ -212,13 +212,24 @@ static DRAWSEGMENT* findPoint( const wxPoint& aPoint, TYPE_COLLECTOR* items )
wxASSERT( graphic->Type() == PCB_LINE_T ); wxASSERT( graphic->Type() == PCB_LINE_T );
switch( graphic->GetShape() )
{
case S_ARC:
if( aPoint == graphic->GetArcStart() || aPoint == graphic->GetArcEnd() )
{
items->Remove(i);
return graphic;
}
break;
default:
if( aPoint == graphic->GetStart() || aPoint == graphic->GetEnd() ) if( aPoint == graphic->GetStart() || aPoint == graphic->GetEnd() )
{ {
items->Remove(i); items->Remove(i);
return graphic; return graphic;
} }
} }
}
#if defined(DEBUG) #if defined(DEBUG)
printf("Unable to find segment matching point (%d,%d)\n", printf("Unable to find segment matching point (%d,%d)\n",
...@@ -229,7 +240,7 @@ static DRAWSEGMENT* findPoint( const wxPoint& aPoint, TYPE_COLLECTOR* items ) ...@@ -229,7 +240,7 @@ static DRAWSEGMENT* findPoint( const wxPoint& aPoint, TYPE_COLLECTOR* items )
DRAWSEGMENT* graphic = (DRAWSEGMENT*) (*items)[i]; DRAWSEGMENT* graphic = (DRAWSEGMENT*) (*items)[i];
printf( "type=%s, GetStart()=%d,%d GetEnd()=%d,%d\n", printf( "type=%s, GetStart()=%d,%d GetEnd()=%d,%d\n",
TO_UTF8( BOARD_ITEM::ShowShape( (STROKE_T) graphic->m_Shape ) ), TO_UTF8( BOARD_ITEM::ShowShape( (STROKE_T) graphic->GetShape() ) ),
graphic->GetStart().x, graphic->GetStart().x,
graphic->GetStart().y, graphic->GetStart().y,
graphic->GetEnd().x, graphic->GetEnd().x,
...@@ -614,17 +625,17 @@ IMAGE* SPECCTRA_DB::makeIMAGE( BOARD* aBoard, MODULE* aModule ) ...@@ -614,17 +625,17 @@ IMAGE* SPECCTRA_DB::makeIMAGE( BOARD* aBoard, MODULE* aModule )
SHAPE* outline; SHAPE* outline;
PATH* path; PATH* path;
switch( graphic->m_Shape ) switch( graphic->GetShape() )
{ {
case S_SEGMENT: case S_SEGMENT:
outline = new SHAPE( image, T_outline ); outline = new SHAPE( image, T_outline );
image->Append( outline ); image->Append( outline );
path = new PATH( outline ); path = new PATH( outline );
outline->SetShape( path ); outline->SetShape( path );
path->SetAperture( scale( graphic->m_Width ) ); path->SetAperture( scale( graphic->GetWidth() ) );
path->SetLayerId( "signal" ); path->SetLayerId( "signal" );
path->AppendPoint( mapPt( graphic->m_Start0 ) ); path->AppendPoint( mapPt( graphic->GetStart0() ) );
path->AppendPoint( mapPt( graphic->m_End0 ) ); path->AppendPoint( mapPt( graphic->GetEnd0() ) );
break; break;
case S_CIRCLE: case S_CIRCLE:
...@@ -636,7 +647,7 @@ IMAGE* SPECCTRA_DB::makeIMAGE( BOARD* aBoard, MODULE* aModule ) ...@@ -636,7 +647,7 @@ IMAGE* SPECCTRA_DB::makeIMAGE( BOARD* aBoard, MODULE* aModule )
image->Append( outline ); image->Append( outline );
path = new PATH( outline ); path = new PATH( outline );
outline->SetShape( path ); outline->SetShape( path );
path->SetAperture( scale( graphic->m_Width ) ); path->SetAperture( scale( graphic->GetWidth() ) );
path->SetLayerId( "signal" ); path->SetLayerId( "signal" );
// Do the math using KiCad units, that way we stay out of the // Do the math using KiCad units, that way we stay out of the
...@@ -645,8 +656,8 @@ IMAGE* SPECCTRA_DB::makeIMAGE( BOARD* aBoard, MODULE* aModule ) ...@@ -645,8 +656,8 @@ IMAGE* SPECCTRA_DB::makeIMAGE( BOARD* aBoard, MODULE* aModule )
// lexer/beautifier, and the spec is not clear that this is // lexer/beautifier, and the spec is not clear that this is
// required. Fixed point floats are all that should be needed. // required. Fixed point floats are all that should be needed.
double radius = hypot( double( graphic->m_Start.x - graphic->m_End.x ), double radius = hypot( double( graphic->GetStart().x - graphic->GetEnd().x ),
double( graphic->m_Start.y - graphic->m_End.y ) ); double( graphic->GetStart().y - graphic->GetEnd().y ) );
// better if evenly divisible into 360 // better if evenly divisible into 360
const int DEGREE_INTERVAL = 18; // 18 means 20 line segments const int DEGREE_INTERVAL = 18; // 18 means 20 line segments
...@@ -667,7 +678,7 @@ IMAGE* SPECCTRA_DB::makeIMAGE( BOARD* aBoard, MODULE* aModule ) ...@@ -667,7 +678,7 @@ IMAGE* SPECCTRA_DB::makeIMAGE( BOARD* aBoard, MODULE* aModule )
case S_ARC: case S_ARC:
default: default:
D( printf("makeIMAGE(): unsupported shape %s\n", D( printf("makeIMAGE(): unsupported shape %s\n",
TO_UTF8( BOARD_ITEM::ShowShape( (STROKE_T) graphic->m_Shape)) );) TO_UTF8( BOARD_ITEM::ShowShape( (STROKE_T) graphic->GetShape() )) );)
continue; continue;
} }
} }
...@@ -778,7 +789,7 @@ void SPECCTRA_DB::fillBOUNDARY( BOARD* aBoard, BOUNDARY* boundary ) throw( IO_ER ...@@ -778,7 +789,7 @@ void SPECCTRA_DB::fillBOUNDARY( BOARD* aBoard, BOUNDARY* boundary ) throw( IO_ER
for(;;) for(;;)
{ {
switch( graphic->m_Shape ) switch( graphic->GetShape() )
{ {
case S_SEGMENT: case S_SEGMENT:
{ {
...@@ -807,14 +818,14 @@ void SPECCTRA_DB::fillBOUNDARY( BOARD* aBoard, BOUNDARY* boundary ) throw( IO_ER ...@@ -807,14 +818,14 @@ void SPECCTRA_DB::fillBOUNDARY( BOARD* aBoard, BOUNDARY* boundary ) throw( IO_ER
{ {
const int STEPS = 9; // in an arc of 90 degrees const int STEPS = 9; // in an arc of 90 degrees
wxPoint start = graphic->GetStart(); wxPoint start = graphic->GetArcStart();
wxPoint end = graphic->GetEnd(); wxPoint end = graphic->GetArcEnd();
wxPoint center = graphic->m_Start; wxPoint center = graphic->GetCenter();
int angle = -graphic->m_Angle; double angle = -graphic->GetAngle();
if( prevPt != start ) if( prevPt != start )
{ {
wxASSERT( prevPt == graphic->GetEnd() ); wxASSERT( prevPt == graphic->GetArcEnd() );
angle = -angle; angle = -angle;
EXCHG( start, end ); EXCHG( start, end );
...@@ -824,7 +835,7 @@ void SPECCTRA_DB::fillBOUNDARY( BOARD* aBoard, BOUNDARY* boundary ) throw( IO_ER ...@@ -824,7 +835,7 @@ void SPECCTRA_DB::fillBOUNDARY( BOARD* aBoard, BOUNDARY* boundary ) throw( IO_ER
for( int step=1; step<=STEPS; ++step ) for( int step=1; step<=STEPS; ++step )
{ {
int rotation = ( angle * step )/STEPS; double rotation = ( angle * step )/STEPS;
nextPt = start; nextPt = start;
...@@ -858,7 +869,7 @@ void SPECCTRA_DB::fillBOUNDARY( BOARD* aBoard, BOUNDARY* boundary ) throw( IO_ER ...@@ -858,7 +869,7 @@ void SPECCTRA_DB::fillBOUNDARY( BOARD* aBoard, BOUNDARY* boundary ) throw( IO_ER
wxString error; wxString error;
error.Printf( _("Unsupported DRAWSEGMENT type %s"), error.Printf( _("Unsupported DRAWSEGMENT type %s"),
GetChars( BOARD_ITEM::ShowShape( (STROKE_T) graphic->m_Shape ) ) ); GetChars( BOARD_ITEM::ShowShape( (STROKE_T) graphic->GetShape() ) ) );
ThrowIOError( error ); ThrowIOError( error );
} }
......
...@@ -270,7 +270,7 @@ SEGVIA* SPECCTRA_DB::makeVIA( PADSTACK* aPadstack, const POINT& aPoint, int aNet ...@@ -270,7 +270,7 @@ SEGVIA* SPECCTRA_DB::makeVIA( PADSTACK* aPadstack, const POINT& aPoint, int aNet
via = new SEGVIA( sessionBoard ); via = new SEGVIA( sessionBoard );
via->SetPosition( mapPt( aPoint, routeResolution ) ); via->SetPosition( mapPt( aPoint, routeResolution ) );
via->SetDrillValue( drillDiam ); via->SetDrill( drillDiam );
via->m_Shape = VIA_THROUGH; via->m_Shape = VIA_THROUGH;
via->m_Width = viaDiam; via->m_Width = viaDiam;
via->SetLayerPair( LAYER_N_FRONT, LAYER_N_BACK ); via->SetLayerPair( LAYER_N_FRONT, LAYER_N_BACK );
...@@ -288,7 +288,7 @@ SEGVIA* SPECCTRA_DB::makeVIA( PADSTACK* aPadstack, const POINT& aPoint, int aNet ...@@ -288,7 +288,7 @@ SEGVIA* SPECCTRA_DB::makeVIA( PADSTACK* aPadstack, const POINT& aPoint, int aNet
via = new SEGVIA( sessionBoard ); via = new SEGVIA( sessionBoard );
via->SetPosition( mapPt( aPoint, routeResolution ) ); via->SetPosition( mapPt( aPoint, routeResolution ) );
via->SetDrillValue( drillDiam ); via->SetDrill( drillDiam );
via->m_Shape = VIA_THROUGH; via->m_Shape = VIA_THROUGH;
via->m_Width = viaDiam; via->m_Width = viaDiam;
via->SetLayerPair( LAYER_N_FRONT, LAYER_N_BACK ); via->SetLayerPair( LAYER_N_FRONT, LAYER_N_BACK );
...@@ -329,7 +329,7 @@ SEGVIA* SPECCTRA_DB::makeVIA( PADSTACK* aPadstack, const POINT& aPoint, int aNet ...@@ -329,7 +329,7 @@ SEGVIA* SPECCTRA_DB::makeVIA( PADSTACK* aPadstack, const POINT& aPoint, int aNet
via = new SEGVIA( sessionBoard ); via = new SEGVIA( sessionBoard );
via->SetPosition( mapPt( aPoint, routeResolution ) ); via->SetPosition( mapPt( aPoint, routeResolution ) );
via->SetDrillValue( drillDiam ); via->SetDrill( drillDiam );
if( (topLayerNdx==0 && botLayerNdx==1) if( (topLayerNdx==0 && botLayerNdx==1)
|| (topLayerNdx==copperLayerCount-2 && botLayerNdx==copperLayerCount-1)) || (topLayerNdx==copperLayerCount-2 && botLayerNdx==copperLayerCount-1))
......
...@@ -371,7 +371,7 @@ void PCB_EDIT_FRAME::Swap_Layers( wxCommandEvent& event ) ...@@ -371,7 +371,7 @@ void PCB_EDIT_FRAME::Swap_Layers( wxCommandEvent& event )
{ {
SEGVIA* Via = (SEGVIA*) pt_segm; SEGVIA* Via = (SEGVIA*) pt_segm;
if( Via->Shape() == VIA_THROUGH ) if( Via->GetShape() == VIA_THROUGH )
continue; continue;
int top_layer, bottom_layer; int top_layer, bottom_layer;
......
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