|
|
@ -14,6 +14,11 @@ |
|
|
|
|
|
|
|
|
#include "protos.h"
|
|
|
#include "protos.h"
|
|
|
|
|
|
|
|
|
|
|
|
/* used to calculate the pen size from default value
|
|
|
|
|
|
* the actual pen size is default value * BUS_WIDTH_EXPAND |
|
|
|
|
|
*/ |
|
|
|
|
|
#define BUS_WIDTH_EXPAND 1.4
|
|
|
|
|
|
|
|
|
/****************************/ |
|
|
/****************************/ |
|
|
/* class DrawBusEntryStruct */ |
|
|
/* class DrawBusEntryStruct */ |
|
|
/***************************/ |
|
|
/***************************/ |
|
|
@ -115,13 +120,14 @@ EDA_Rect DrawBusEntryStruct::GetBoundingBox() |
|
|
/** Function GetPenSize
|
|
|
/** Function GetPenSize
|
|
|
* @return the size of the "pen" that be used to draw or plot this item |
|
|
* @return the size of the "pen" that be used to draw or plot this item |
|
|
*/ |
|
|
*/ |
|
|
int DrawBusEntryStruct::GetPenSize( ) |
|
|
|
|
|
|
|
|
int DrawBusEntryStruct::GetPenSize() |
|
|
{ |
|
|
{ |
|
|
int pensize = (m_Width == 0) ? g_DrawDefaultLineThickness : m_Width; |
|
|
int pensize = (m_Width == 0) ? g_DrawDefaultLineThickness : m_Width; |
|
|
if( m_Layer == LAYER_BUS ) // TODO: find a better way to handle bus thickness
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if( m_Layer == LAYER_BUS && m_Width == 0 ) |
|
|
{ |
|
|
{ |
|
|
pensize = wxRound(pensize * 1.3); |
|
|
|
|
|
pensize = MAX(pensize, 3); |
|
|
|
|
|
|
|
|
pensize = wxRound( g_DrawDefaultLineThickness * BUS_WIDTH_EXPAND ); |
|
|
|
|
|
pensize = MAX( pensize, 3 ); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return pensize; |
|
|
return pensize; |
|
|
@ -140,7 +146,7 @@ void DrawBusEntryStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, |
|
|
GRSetDrawMode( DC, DrawMode ); |
|
|
GRSetDrawMode( DC, DrawMode ); |
|
|
|
|
|
|
|
|
GRLine( &panel->m_ClipBox, DC, m_Pos.x + offset.x, m_Pos.y + offset.y, |
|
|
GRLine( &panel->m_ClipBox, DC, m_Pos.x + offset.x, m_Pos.y + offset.y, |
|
|
m_End().x + offset.x, m_End().y + offset.y, GetPenSize( ), color ); |
|
|
|
|
|
|
|
|
m_End().x + offset.x, m_End().y + offset.y, GetPenSize(), color ); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -187,6 +193,7 @@ bool DrawJunctionStruct::Save( FILE* aFile ) const |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
EDA_Rect DrawJunctionStruct::GetBoundingBox() |
|
|
EDA_Rect DrawJunctionStruct::GetBoundingBox() |
|
|
|
|
|
|
|
|
// return a bounding box
|
|
|
// return a bounding box
|
|
|
{ |
|
|
{ |
|
|
int width = DRAWJUNCTION_SIZE * 2; |
|
|
int width = DRAWJUNCTION_SIZE * 2; |
|
|
@ -216,11 +223,12 @@ bool DrawJunctionStruct::HitTest( const wxPoint& aPosRef ) |
|
|
* @return the size of the "pen" that be used to draw or plot this item |
|
|
* @return the size of the "pen" that be used to draw or plot this item |
|
|
* has no meaning for DrawJunctionStruct |
|
|
* has no meaning for DrawJunctionStruct |
|
|
*/ |
|
|
*/ |
|
|
int DrawJunctionStruct::GetPenSize( ) |
|
|
|
|
|
|
|
|
int DrawJunctionStruct::GetPenSize() |
|
|
{ |
|
|
{ |
|
|
return 0; |
|
|
return 0; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************
|
|
|
/*****************************************************************************
|
|
|
* Routine to redraw connection struct. * |
|
|
* Routine to redraw connection struct. * |
|
|
*****************************************************************************/ |
|
|
*****************************************************************************/ |
|
|
@ -250,6 +258,7 @@ void DrawJunctionStruct::Show( int nestLevel, std::ostream& os ) |
|
|
<< m_Pos << "/>\n"; |
|
|
<< m_Pos << "/>\n"; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -296,7 +305,8 @@ bool DrawNoConnectStruct::HitTest( const wxPoint& aPosRef ) |
|
|
int delta = ( DRAWNOCONNECT_SIZE + width) / 2; |
|
|
int delta = ( DRAWNOCONNECT_SIZE + width) / 2; |
|
|
|
|
|
|
|
|
wxPoint dist = aPosRef - m_Pos; |
|
|
wxPoint dist = aPosRef - m_Pos; |
|
|
if( (ABS(dist.x) <= delta) && (ABS(dist.y) <= delta) ) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if( (ABS( dist.x ) <= delta) && (ABS( dist.y ) <= delta) ) |
|
|
return true; |
|
|
return true; |
|
|
return false; |
|
|
return false; |
|
|
} |
|
|
} |
|
|
@ -324,11 +334,12 @@ bool DrawNoConnectStruct::Save( FILE* aFile ) const |
|
|
/** Function GetPenSize
|
|
|
/** Function GetPenSize
|
|
|
* @return the size of the "pen" that be used to draw or plot this item |
|
|
* @return the size of the "pen" that be used to draw or plot this item |
|
|
*/ |
|
|
*/ |
|
|
int DrawNoConnectStruct::GetPenSize( ) |
|
|
|
|
|
|
|
|
int DrawNoConnectStruct::GetPenSize() |
|
|
{ |
|
|
{ |
|
|
return g_DrawDefaultLineThickness; |
|
|
return g_DrawDefaultLineThickness; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void DrawNoConnectStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, |
|
|
void DrawNoConnectStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, |
|
|
const wxPoint& offset, int DrawMode, int Color ) |
|
|
const wxPoint& offset, int DrawMode, int Color ) |
|
|
{ |
|
|
{ |
|
|
@ -420,7 +431,7 @@ wxString DrawMarkerStruct::GetComment() |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if defined (DEBUG)
|
|
|
|
|
|
|
|
|
#if defined(DEBUG)
|
|
|
|
|
|
|
|
|
/**
|
|
|
/**
|
|
|
* Function Show |
|
|
* Function Show |
|
|
@ -435,6 +446,8 @@ void DrawMarkerStruct::Show( int nestLevel, std::ostream& os ) |
|
|
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() << m_Pos |
|
|
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() << m_Pos |
|
|
<< "/>\n"; |
|
|
<< "/>\n"; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
#endif
|
|
|
|
|
|
|
|
|
/**
|
|
|
/**
|
|
|
@ -448,7 +461,7 @@ bool DrawMarkerStruct::Save( FILE* aFile ) const |
|
|
bool success = true; |
|
|
bool success = true; |
|
|
|
|
|
|
|
|
if( fprintf( aFile, "Kmarq %c %-4d %-4d \"%s\" F=%X\n", |
|
|
if( fprintf( aFile, "Kmarq %c %-4d %-4d \"%s\" F=%X\n", |
|
|
int( m_Type ) + 'A', m_Pos.x, m_Pos.y, |
|
|
|
|
|
|
|
|
int(m_Type) + 'A', m_Pos.x, m_Pos.y, |
|
|
CONV_TO_UTF8( m_Comment ), m_MarkFlags ) == EOF ) |
|
|
CONV_TO_UTF8( m_Comment ), m_MarkFlags ) == EOF ) |
|
|
{ |
|
|
{ |
|
|
success = false; |
|
|
success = false; |
|
|
@ -530,7 +543,7 @@ bool EDA_DrawLineStruct::IsOneEndPointAt( const wxPoint& pos ) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if defined (DEBUG)
|
|
|
|
|
|
|
|
|
#if defined(DEBUG)
|
|
|
|
|
|
|
|
|
/**
|
|
|
/**
|
|
|
* Function Show |
|
|
* Function Show |
|
|
@ -551,6 +564,7 @@ void EDA_DrawLineStruct::Show( int nestLevel, std::ostream& os ) |
|
|
"</" << GetClass().Lower().mb_str() << ">\n"; |
|
|
"</" << GetClass().Lower().mb_str() << ">\n"; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -593,8 +607,8 @@ bool EDA_DrawLineStruct::Save( FILE* aFile ) const |
|
|
{ |
|
|
{ |
|
|
success = false; |
|
|
success = false; |
|
|
} |
|
|
} |
|
|
if ( fprintf( aFile, "\t%-4d %-4d %-4d %-4d\n", m_Start.x,m_Start.y, |
|
|
|
|
|
m_End.x,m_End.y ) == EOF ) |
|
|
|
|
|
|
|
|
if( fprintf( aFile, "\t%-4d %-4d %-4d %-4d\n", m_Start.x, m_Start.y, |
|
|
|
|
|
m_End.x, m_End.y ) == EOF ) |
|
|
{ |
|
|
{ |
|
|
success = false; |
|
|
success = false; |
|
|
} |
|
|
} |
|
|
@ -606,17 +620,25 @@ bool EDA_DrawLineStruct::Save( FILE* aFile ) const |
|
|
/** Function GetPenSize
|
|
|
/** Function GetPenSize
|
|
|
* @return the size of the "pen" that be used to draw or plot this item |
|
|
* @return the size of the "pen" that be used to draw or plot this item |
|
|
*/ |
|
|
*/ |
|
|
int EDA_DrawLineStruct::GetPenSize( ) |
|
|
|
|
|
|
|
|
int EDA_DrawLineStruct::GetPenSize() |
|
|
{ |
|
|
{ |
|
|
int pensize = (m_Width == 0) ? g_DrawDefaultLineThickness : m_Width; |
|
|
int pensize = (m_Width == 0) ? g_DrawDefaultLineThickness : m_Width; |
|
|
|
|
|
|
|
|
|
|
|
if( m_Layer == LAYER_BUS && m_Width == 0 ) |
|
|
|
|
|
{ |
|
|
|
|
|
pensize = wxRound( g_DrawDefaultLineThickness * BUS_WIDTH_EXPAND ); |
|
|
|
|
|
pensize = MAX( pensize, 3 ); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
return pensize; |
|
|
return pensize; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void EDA_DrawLineStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, |
|
|
void EDA_DrawLineStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, |
|
|
const wxPoint& offset, int DrawMode, int Color ) |
|
|
const wxPoint& offset, int DrawMode, int Color ) |
|
|
{ |
|
|
{ |
|
|
int color; |
|
|
int color; |
|
|
int width = GetPenSize( ); |
|
|
|
|
|
|
|
|
int width = GetPenSize(); |
|
|
|
|
|
|
|
|
if( Color >= 0 ) |
|
|
if( Color >= 0 ) |
|
|
color = Color; |
|
|
color = Color; |
|
|
@ -625,13 +647,6 @@ void EDA_DrawLineStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, |
|
|
|
|
|
|
|
|
GRSetDrawMode( DC, DrawMode ); |
|
|
GRSetDrawMode( DC, DrawMode ); |
|
|
|
|
|
|
|
|
// FIXME: Not compatable with new zoom.
|
|
|
|
|
|
if( m_Layer == LAYER_BUS) |
|
|
|
|
|
{ |
|
|
|
|
|
width = wxRound(width * 1.4); |
|
|
|
|
|
width = MAX(width, 3); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if( m_Layer == LAYER_NOTES ) |
|
|
if( m_Layer == LAYER_NOTES ) |
|
|
GRDashedLine( &panel->m_ClipBox, DC, m_Start.x + offset.x, |
|
|
GRDashedLine( &panel->m_ClipBox, DC, m_Start.x + offset.x, |
|
|
m_Start.y + offset.y, m_End.x + offset.x, |
|
|
m_Start.y + offset.y, m_End.x + offset.x, |
|
|
@ -681,6 +696,7 @@ DrawPolylineStruct::~DrawPolylineStruct() |
|
|
DrawPolylineStruct* DrawPolylineStruct::GenCopy() |
|
|
DrawPolylineStruct* DrawPolylineStruct::GenCopy() |
|
|
{ |
|
|
{ |
|
|
DrawPolylineStruct* newitem = new DrawPolylineStruct( m_Layer ); |
|
|
DrawPolylineStruct* newitem = new DrawPolylineStruct( m_Layer ); |
|
|
|
|
|
|
|
|
newitem->m_PolyPoints = m_PolyPoints; // std::vector copy
|
|
|
newitem->m_PolyPoints = m_PolyPoints; // std::vector copy
|
|
|
return newitem; |
|
|
return newitem; |
|
|
} |
|
|
} |
|
|
@ -725,17 +741,19 @@ bool DrawPolylineStruct::Save( FILE* aFile ) const |
|
|
/** Function GetPenSize
|
|
|
/** Function GetPenSize
|
|
|
* @return the size of the "pen" that be used to draw or plot this item |
|
|
* @return the size of the "pen" that be used to draw or plot this item |
|
|
*/ |
|
|
*/ |
|
|
int DrawPolylineStruct::GetPenSize( ) |
|
|
|
|
|
|
|
|
int DrawPolylineStruct::GetPenSize() |
|
|
{ |
|
|
{ |
|
|
int pensize = (m_Width == 0) ? g_DrawDefaultLineThickness : m_Width; |
|
|
int pensize = (m_Width == 0) ? g_DrawDefaultLineThickness : m_Width; |
|
|
|
|
|
|
|
|
return pensize; |
|
|
return pensize; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void DrawPolylineStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, |
|
|
void DrawPolylineStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, |
|
|
const wxPoint& offset, int DrawMode, int Color ) |
|
|
const wxPoint& offset, int DrawMode, int Color ) |
|
|
{ |
|
|
{ |
|
|
int color; |
|
|
int color; |
|
|
int width = GetPenSize( ); |
|
|
|
|
|
|
|
|
int width = GetPenSize(); |
|
|
|
|
|
|
|
|
if( Color >= 0 ) |
|
|
if( Color >= 0 ) |
|
|
color = Color; |
|
|
color = Color; |
|
|
|