Commit aac10106 authored by Dick Hollenbeck's avatar Dick Hollenbeck

more eagle_plugin work

parent cb210042
...@@ -1340,7 +1340,7 @@ public: ...@@ -1340,7 +1340,7 @@ public:
void ShowTargetOptionsDialog( PCB_TARGET* aTarget, wxDC* DC ); void ShowTargetOptionsDialog( PCB_TARGET* aTarget, wxDC* DC );
// Graphic segments type DRAWSEGMENT handling: // Graphic segments type DRAWSEGMENT handling:
DRAWSEGMENT* Begin_DrawSegment( DRAWSEGMENT* Segment, int shape, wxDC* DC ); DRAWSEGMENT* Begin_DrawSegment( DRAWSEGMENT* Segment, STROKE_T shape, wxDC* DC );
void End_Edge( DRAWSEGMENT* Segment, wxDC* DC ); void End_Edge( DRAWSEGMENT* Segment, wxDC* DC );
void Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC ); void Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC );
void Delete_Drawings_All_Layer( int aLayer ); void Delete_Drawings_All_Layer( int aLayer );
......
...@@ -124,6 +124,10 @@ const wxPoint DRAWSEGMENT::GetArcEnd() const ...@@ -124,6 +124,10 @@ const wxPoint DRAWSEGMENT::GetArcEnd() const
// m_Start is the arc centre // m_Start is the arc centre
endPoint = m_End; // m_End = start point of arc endPoint = m_End; // m_End = start point of arc
RotatePoint( &endPoint, m_Start, -m_Angle ); RotatePoint( &endPoint, m_Start, -m_Angle );
break;
default:
;
} }
return endPoint; // after rotation, the end of the arc. return endPoint; // after rotation, the end of the arc.
...@@ -429,8 +433,11 @@ EDA_RECT DRAWSEGMENT::GetBoundingBox() const ...@@ -429,8 +433,11 @@ EDA_RECT DRAWSEGMENT::GetBoundingBox() const
} }
bbox.SetEnd( p_end ); bbox.SetEnd( p_end );
break;
} }
break;
default:
;
} }
bbox.Inflate( ((m_Width+1) / 2) + 1 ); bbox.Inflate( ((m_Width+1) / 2) + 1 );
...@@ -520,6 +527,9 @@ bool DRAWSEGMENT::HitTest( const EDA_RECT& aRect ) const ...@@ -520,6 +527,9 @@ bool DRAWSEGMENT::HitTest( const EDA_RECT& aRect ) const
if( aRect.Contains( GetEnd() ) ) if( aRect.Contains( GetEnd() ) )
return true; return true;
break; break;
default:
;
} }
return false; return false;
} }
......
...@@ -47,7 +47,7 @@ protected: ...@@ -47,7 +47,7 @@ protected:
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 STROKE_T m_Shape; ///< Shape: line, Circle, Arc
int m_Type; ///< Used in complex associations ( Dimensions.. ) int m_Type; ///< Used in complex associations ( Dimensions.. )
double 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
...@@ -83,8 +83,8 @@ public: ...@@ -83,8 +83,8 @@ public:
void SetType( int aType ) { m_Type = aType; } void SetType( int aType ) { m_Type = aType; }
int GetType() const { return m_Type; } int GetType() const { return m_Type; }
void SetShape( int aShape ) { m_Shape = aShape; } void SetShape( STROKE_T aShape ) { m_Shape = aShape; }
int GetShape() const { return m_Shape; } STROKE_T GetShape() const { return m_Shape; }
void SetBezControl1( const wxPoint& aPoint ) { m_BezierC1 = aPoint; } void SetBezControl1( const wxPoint& aPoint ) { m_BezierC1 = aPoint; }
const wxPoint& GetBezControl1() const { return m_BezierC1; } const wxPoint& GetBezControl1() const { return m_BezierC1; }
......
...@@ -294,6 +294,11 @@ public: ...@@ -294,6 +294,11 @@ public:
m_Value->m_Text = aValue; m_Value->m_Text = aValue;
} }
/// read/write accessors:
TEXTE_MODULE& Value() { return *m_Value; }
TEXTE_MODULE& Reference() { return *m_Reference; }
/** /**
* Function FindPadByName * Function FindPadByName
* returns a D_PAD* with a matching name. Note that names may not be * returns a D_PAD* with a matching name. Note that names may not be
......
This diff is collapsed.
...@@ -55,15 +55,10 @@ namespace boost { ...@@ -55,15 +55,10 @@ namespace boost {
typedef boost::property_tree::ptree PTREE; typedef boost::property_tree::ptree PTREE;
typedef const PTREE CPTREE; typedef const PTREE CPTREE;
struct EWIRE ///< Eagle wire struct EWIRE;
{ struct EROT;
double x1; struct EATTR;
double y1; struct ECIRCLE;
double x2;
double y2;
double width;
int layer;
};
/** /**
...@@ -104,11 +99,11 @@ public: ...@@ -104,11 +99,11 @@ public:
EAGLE_PLUGIN(); EAGLE_PLUGIN();
~EAGLE_PLUGIN(); ~EAGLE_PLUGIN();
private: private:
MODULE_MAP m_modules; ///< is a factory by use of MODULE copy constructor, MODULE_MAP m_templates; ///< is part of a MODULE factory that operates
///< lookup is based on libname.packagename ///< using copy construction.
///< lookup key is libname.packagename
PROPERTIES* m_props; ///< passed via Save() or Load(), no ownership, may be NULL. PROPERTIES* m_props; ///< passed via Save() or Load(), no ownership, may be NULL.
...@@ -120,10 +115,10 @@ private: ...@@ -120,10 +115,10 @@ private:
void init( PROPERTIES* aProperties ); void init( PROPERTIES* aProperties );
int kicad( double d ) const; int kicad( double d ) const;
int kicad_y( double y ) const { return kicad( y ); } int kicad_y( double y ) const { return -kicad( y ); }
int kicad_x( double x ) const { return kicad( x ); } int kicad_x( double x ) const { return kicad( x ); }
int kicad_layer( int aLayer ) const; static int kicad_layer( int aLayer );
double eagle( BIU d ) const { return mm_per_biu * d; } double eagle( BIU d ) const { return mm_per_biu * d; }
double eagle_x( BIU x ) const { return eagle( x ); } double eagle_x( BIU x ) const { return eagle( x ); }
...@@ -202,16 +197,32 @@ private: ...@@ -202,16 +197,32 @@ private:
void loadAllSections( CPTREE& aEagleBoard, const std::string& aXpath, bool aAppendToMe ); void loadAllSections( CPTREE& aEagleBoard, const std::string& aXpath, bool aAppendToMe );
void loadPlain( CPTREE& aPlain, const std::string& aXpath );
void loadNetsAndTracks( CPTREE& aSignals, const std::string& aXpath ); void loadNetsAndTracks( CPTREE& aSignals, const std::string& aXpath );
void loadModules( CPTREE& aLibs, const std::string& aXpath ); void loadLibraries( CPTREE& aLibs, const std::string& aXpath );
void loadElements( CPTREE& aElements, const std::string& aXpath );
/** /**
* Function wire * Function ewire
* converts a <wire>'s xml attributes to binary without additional conversion. * converts a <wire>'s xml attributes to binary without additional conversion.
* @return EWIRE - an Eagle <wire> object in binary. * @param aResult is an EWIRE to fill in with the <wire> data converted to binary.
*/
EWIRE ewire( CPTREE& aWire ) const;
ECIRCLE ecircle( CPTREE& aCircle ) const;
EROT erot( const std::string& aRot ) const;
/**
* Function eattr
* parses an Eagle "attribute" element. Note that an attribute element
* is different than an XML element attribute. The attribute element is a
* full XML node in and of itself, and has attributes of its own. Blame Eagle.
*/ */
EWIRE wire( CPTREE aWire ) const; EATTR eattr( CPTREE& aAttribute ) const;
/** /**
* Function fmtDEG * Function fmtDEG
......
...@@ -310,7 +310,7 @@ static void Abort_Move_ModuleOutline( EDA_DRAW_PANEL* Panel, wxDC* DC ) ...@@ -310,7 +310,7 @@ static void Abort_Move_ModuleOutline( EDA_DRAW_PANEL* Panel, wxDC* DC )
EDGE_MODULE* FOOTPRINT_EDIT_FRAME::Begin_Edge_Module( EDGE_MODULE* aEdge, EDGE_MODULE* FOOTPRINT_EDIT_FRAME::Begin_Edge_Module( EDGE_MODULE* aEdge,
wxDC* DC, wxDC* DC,
int type_edge ) STROKE_T type_edge )
{ {
MODULE* module = GetBoard()->m_Modules; MODULE* module = GetBoard()->m_Modules;
int angle = 0; int angle = 0;
......
...@@ -231,7 +231,7 @@ static void Abort_EditEdge( EDA_DRAW_PANEL* Panel, wxDC* DC ) ...@@ -231,7 +231,7 @@ static void Abort_EditEdge( EDA_DRAW_PANEL* Panel, wxDC* DC )
/* Initialize the drawing of a segment of type other than trace. /* Initialize the drawing of a segment of type other than trace.
*/ */
DRAWSEGMENT* PCB_EDIT_FRAME::Begin_DrawSegment( DRAWSEGMENT* Segment, int shape, wxDC* DC ) DRAWSEGMENT* PCB_EDIT_FRAME::Begin_DrawSegment( DRAWSEGMENT* Segment, STROKE_T shape, wxDC* DC )
{ {
int s_large; int s_large;
DRAWSEGMENT* DrawItem; DRAWSEGMENT* DrawItem;
......
...@@ -1238,7 +1238,7 @@ void LEGACY_PLUGIN::loadPAD( MODULE* aModule ) ...@@ -1238,7 +1238,7 @@ void LEGACY_PLUGIN::loadPAD( MODULE* aModule )
pos.y = biuParse( data ); pos.y = biuParse( data );
pad->SetPos0( pos ); pad->SetPos0( pos );
pad->SetPosition( pos ); // pad->SetPosition( pos ); set at function return
} }
else if( TESTLINE( "Le" ) ) else if( TESTLINE( "Le" ) )
...@@ -1291,7 +1291,10 @@ void LEGACY_PLUGIN::loadPAD( MODULE* aModule ) ...@@ -1291,7 +1291,10 @@ void LEGACY_PLUGIN::loadPAD( MODULE* aModule )
else if( TESTLINE( "$EndPAD" ) ) else if( TESTLINE( "$EndPAD" ) )
{ {
wxPoint padpos = pad->GetPosition(); // pad's "Position" is not relative to the module's,
// whereas Pos0 is relative to the module's but is the unrotated coordinate.
wxPoint padpos = pad->GetPos0();
RotatePoint( &padpos, aModule->GetOrientation() ); RotatePoint( &padpos, aModule->GetOrientation() );
...@@ -1634,7 +1637,7 @@ void LEGACY_PLUGIN::loadPCB_LINE() ...@@ -1634,7 +1637,7 @@ void LEGACY_PLUGIN::loadPCB_LINE()
if( width < 0 ) if( width < 0 )
width = 0; width = 0;
dseg->SetShape( shape ); dseg->SetShape( STROKE_T( shape ) );
dseg->SetWidth( width ); dseg->SetWidth( width );
dseg->SetStart( wxPoint( start_x, start_y ) ); dseg->SetStart( wxPoint( start_x, start_y ) );
dseg->SetEnd( wxPoint( end_x, end_y ) ); dseg->SetEnd( wxPoint( end_x, end_y ) );
......
...@@ -81,7 +81,7 @@ void FOOTPRINT_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -81,7 +81,7 @@ void FOOTPRINT_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
case ID_MODEDIT_LINE_TOOL: case ID_MODEDIT_LINE_TOOL:
if( !item || item->GetFlags() == 0 ) if( !item || item->GetFlags() == 0 )
{ {
int shape = S_SEGMENT; STROKE_T shape = S_SEGMENT;
if( GetToolId() == ID_MODEDIT_CIRCLE_TOOL ) if( GetToolId() == ID_MODEDIT_CIRCLE_TOOL )
shape = S_CIRCLE; shape = S_CIRCLE;
...@@ -107,7 +107,7 @@ void FOOTPRINT_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -107,7 +107,7 @@ void FOOTPRINT_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
} }
else if( ( (EDGE_MODULE*) item )->GetShape() == 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, S_SEGMENT ) );
} }
else else
{ {
......
...@@ -319,7 +319,7 @@ public: ...@@ -319,7 +319,7 @@ public:
* @param type_edge = S_SEGMENT,S_ARC .. * @param type_edge = S_SEGMENT,S_ARC ..
* @return the new created edge. * @return the new created edge.
*/ */
EDGE_MODULE* Begin_Edge_Module( EDGE_MODULE* Edge, wxDC* DC, int type_edge ); EDGE_MODULE* Begin_Edge_Module( EDGE_MODULE* Edge, wxDC* DC, STROKE_T type_edge );
/** /**
* Function End_Edge_Module * Function End_Edge_Module
......
...@@ -230,7 +230,7 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) ...@@ -230,7 +230,7 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
case ID_PCB_ARC_BUTT: case ID_PCB_ARC_BUTT:
case ID_PCB_ADD_LINE_BUTT: case ID_PCB_ADD_LINE_BUTT:
{ {
int shape = S_SEGMENT; STROKE_T shape = S_SEGMENT;
if( GetToolId() == ID_PCB_CIRCLE_BUTT ) if( GetToolId() == ID_PCB_CIRCLE_BUTT )
shape = S_CIRCLE; shape = S_CIRCLE;
...@@ -258,8 +258,8 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) ...@@ -258,8 +258,8 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
SetCurItem( DrawStruct ); SetCurItem( DrawStruct );
m_canvas->SetAutoPanRequest( true ); m_canvas->SetAutoPanRequest( true );
} }
break;
} }
break;
case ID_TRACK_BUTT: case ID_TRACK_BUTT:
if( getActiveLayer() > LAST_COPPER_LAYER ) if( getActiveLayer() > LAST_COPPER_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