Commit 5f777f8c authored by charras's avatar charras

pcbnew: bug solved: pad holes not printed

parent f98fd09f
......@@ -5,6 +5,12 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with
email address.
2008-Aug-09 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
+pcbnew:
bug solved: pads holes not printed.
+eeschema
enforced controls against malformed libraries
2008-Aug-06 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
......
......@@ -320,10 +320,22 @@ void GRSetBrush( wxDC* DC, int Color, int fill )
/*************************************/
void GRForceBlackPen( bool flagforce )
/*************************************/
/** function GRForceBlackPen
* @param flagforce True to force a black pen whenever the asked color
*/
{
ForceBlackPen = flagforce;
}
/***********************************/
bool GetGRForceBlackPenState( void )
/***********************************/
/** function GetGRForceBlackPenState
* @return ForceBlackPen (True if a black pen was forced)
*/
{
return ForceBlackPen;
}
/************************************************************/
/* routines de controle et positionnement du curseur souris */
......
......@@ -67,7 +67,16 @@ int GRGetDrawMode(wxDC * DC);
void GRResetPenAndBrush(wxDC * DC);
void GRSetColorPen(wxDC * DC, int Color , int width = 1, int stype = wxSOLID);
void GRSetBrush(wxDC * DC, int Color , int fill = 0);
/** function GRForceBlackPen
* @param flagforce True to force a black pen whenever the asked color
*/
void GRForceBlackPen(bool flagforce );
/** function GetGRForceBlackPenState
* @return ForceBlackPen (True if a black pen was forced)
*/
bool GetGRForceBlackPenState( void );
void SetPenMinWidth(int minwidth); /* ajustage de la largeur mini de plume */
void GRLine(EDA_Rect * ClipBox, wxDC * DC, int x1, int y1, int x2, int y2, int width, int Color);
......
......@@ -571,7 +571,7 @@ int MODULE::ReadDescr( FILE* File, int* LineNum )
EDA_BaseStruct* LastModStruct = NULL;
EDGE_MODULE* DrawSegm;
TEXTE_MODULE* DrawText;
char Line[256], BufLine[256], BufCar1[128], BufCar2[128], * PtLine;
char Line[256], BufLine[256], BufCar1[128], * PtLine;
int itmp1, itmp2;
while( GetLine( File, Line, LineNum, sizeof(Line) - 1 ) != NULL )
......@@ -672,7 +672,7 @@ int MODULE::ReadDescr( FILE* File, int* LineNum )
}
break;
case 'T': /* lecture des textes modules */
case 'T': /* Read a footprint text description (ref, value, or drawing */
sscanf( Line + 1, "%d", &itmp1 );
if( itmp1 == TEXT_is_REFERENCE )
DrawText = m_Reference;
......@@ -694,48 +694,7 @@ int MODULE::ReadDescr( FILE* File, int* LineNum )
LastModStruct = DrawText;
}
int layer;
sscanf( Line + 1, "%d %d %d %d %d %d %d %s %s %d",
&itmp1,
&DrawText->m_Pos0.x, &DrawText->m_Pos0.y,
&DrawText->m_Size.y, &DrawText->m_Size.x,
&DrawText->m_Orient, &DrawText->m_Width,
BufCar1, BufCar2, &layer );
DrawText->m_Type = itmp1;
DrawText->m_Orient -= m_Orient; // m_Orient texte relative au module
if( BufCar1[0] == 'M' )
DrawText->m_Miroir = 0;
else
DrawText->m_Miroir = 1;
if( BufCar2[0] == 'I' )
DrawText->m_NoShow = 1;
else
DrawText->m_NoShow = 0;
if( layer == COPPER_LAYER_N )
layer = SILKSCREEN_N_CU;
else if( layer == CMP_N )
layer = SILKSCREEN_N_CMP;
DrawText->SetLayer( layer );
/* calcul de la position vraie */
DrawText->SetDrawCoord();
/* Lecture de la chaine "text" */
ReadDelimitedText( BufLine, Line, sizeof(BufLine) );
DrawText->m_Text = CONV_FROM_UTF8( BufLine );
// Test for a reasonnable width:
if( DrawText->m_Width <= 1 )
DrawText->m_Width = 1;
if( DrawText->m_Width > TEXTS_MAX_WIDTH )
DrawText->m_Width = TEXTS_MAX_WIDTH;
// Test for a reasonnable size:
if ( DrawText->m_Size.x < TEXTS_MIN_SIZE )
DrawText->m_Size.x = TEXTS_MIN_SIZE;
if ( DrawText->m_Size.y < TEXTS_MIN_SIZE )
DrawText->m_Size.y = TEXTS_MIN_SIZE;
DrawText->ReadDescr( Line, File, LineNum );
break;
case 'D': /* lecture du contour */
......
......@@ -550,7 +550,15 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin
if( fillpad && hole )
{
color = g_IsPrinting ? WHITE : BLACK; // ou DARKGRAY;
bool blackpenstate = false;
if ( g_IsPrinting )
{
blackpenstate = GetGRForceBlackPenState( );
GRForceBlackPen( false );
color = WHITE;
}
else
color = BLACK; // or DARKGRAY;
if( draw_mode != GR_XOR )
GRSetDrawMode( DC, GR_COPY );
......@@ -589,6 +597,8 @@ void D_PAD::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoin
default:
break;
}
if ( g_IsPrinting )
GRForceBlackPen( blackpenstate );
}
GRSetDrawMode( DC, draw_mode );
......
......@@ -74,6 +74,13 @@ TEXTE_MODULE::~TEXTE_MODULE()
/*******************************************/
bool TEXTE_MODULE::Save( FILE* aFile ) const
/*******************************************/
/**
* Function Save
* writes the data structures for this object out to a FILE in "*.brd" format.
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
*/
{
MODULE* parent = (MODULE*) GetParent();
int orient = m_Orient;
......@@ -91,11 +98,92 @@ bool TEXTE_MODULE::Save( FILE* aFile ) const
GetLayer(),
CONV_TO_UTF8( m_Text ) );
return (ret > 20);
return ret > 20;
}
void TEXTE_MODULE::Copy( TEXTE_MODULE* source ) // copy structure
/*********************************************************************/
int TEXTE_MODULE::ReadDescr( char* aLine, FILE* aFile, int* aLineNum )
/*********************************************************************/
/**
* Function ReadLineDescr
* Read description from a given line in "*.brd" format.
* @param aLine The current line which contains the first line of description.
* @param aLine The FILE to read next lines (currently not used).
* @param LineNum a point to the line count (currently not used).
* @return int - > 0 if success reading else 0.
*/
{
int success = true;
int type;
int layer;
char BufCar1[128], BufCar2[128], BufLine[256];
layer = SILKSCREEN_N_CMP;
BufCar1[0] = 0;
BufCar2[0] = 0;
if ( sscanf( aLine + 1, "%d %d %d %d %d %d %d %s %s %d",
&type,
&m_Pos0.x, &m_Pos0.y,
&m_Size.y, &m_Size.x,
&m_Orient, &m_Width,
BufCar1, BufCar2, &layer ) < 10 )
success = true;
if( (type != TEXT_is_REFERENCE) && (type != TEXT_is_VALUE) )
type = TEXT_is_DIVERS;
m_Type = type;
// .m_Orient member must be relative to the parent module
m_Orient -= ((MODULE * )m_Parent)->m_Orient;
if( BufCar1[0] == 'M' )
m_Miroir = 0;
else
m_Miroir = 1;
if( BufCar2[0] == 'I' )
m_NoShow = 1;
else
m_NoShow = 0;
// Test for a reasonnable layer:
if( layer < 0 )
layer = 0;
if( layer > LAST_NO_COPPER_LAYER )
layer = LAST_NO_COPPER_LAYER;
if( layer == COPPER_LAYER_N )
layer = SILKSCREEN_N_CU;
else if( layer == CMP_N )
layer = SILKSCREEN_N_CMP;
SetLayer( layer );
/* calcul de la position vraie */
SetDrawCoord();
/* Lecture de la chaine "text" */
ReadDelimitedText( BufLine, aLine, sizeof(BufLine) );
m_Text = CONV_FROM_UTF8( BufLine );
// Test for a reasonnable width:
if( m_Width <= 1 )
m_Width = 1;
if( m_Width > TEXTS_MAX_WIDTH )
m_Width = TEXTS_MAX_WIDTH;
// Test for a reasonnable size:
if( m_Size.x < TEXTS_MIN_SIZE )
m_Size.x = TEXTS_MIN_SIZE;
if( m_Size.y < TEXTS_MIN_SIZE )
m_Size.y = TEXTS_MIN_SIZE;
return success;
}
/**********************************************/
void TEXTE_MODULE::Copy( TEXTE_MODULE* source )
/**********************************************/
// copy structure
{
if( source == NULL )
return;
......@@ -201,27 +289,29 @@ void TEXTE_MODULE:: SetLocalCoord()
/** Function GetTextRect
* @return an EDA_Rect which gives the position and size of the text area (for the O orient footprint)
*/
EDA_Rect TEXTE_MODULE::GetTextRect(void)
EDA_Rect TEXTE_MODULE::GetTextRect( void )
{
EDA_Rect area;
int dx, dy;
dx = ( m_Size.x * GetLength() ) / 2;
dx = (dx * 10) / 9 ; /* letter size = 10/9 */
dx = (dx * 10) / 9; /* letter size = 10/9 */
dx += m_Width / 2;
dy = ( m_Size.y + m_Width ) / 2;
wxPoint Org = m_Pos; // This is the position of the centre of the area
Org.x -= dx;
Org.y -= dy;
area.SetOrigin( Org);
area.SetHeight(2 * dy);
area.SetWidth(2 * dx);
area.SetOrigin( Org );
area.SetHeight( 2 * dy );
area.SetWidth( 2 * dx );
area.Normalize();
return area;
}
/**
* Function HitTest
* tests if the given wxPoint is within the bounds of this object.
......@@ -237,14 +327,15 @@ bool TEXTE_MODULE::HitTest( const wxPoint& refPos )
* to test if refPos is within area (which is relative to an horizontal text)
*/
rel_pos = refPos;
RotatePoint( &rel_pos, m_Pos, - GetDrawRotation() );
RotatePoint( &rel_pos, m_Pos, -GetDrawRotation() );
if( area.Inside(rel_pos) )
if( area.Inside( rel_pos ) )
return true;
return false;
}
/**
* Function GetBoundingBox
* returns the bounding box of this Text (according to text and footprint orientation)
......@@ -259,15 +350,16 @@ EDA_Rect TEXTE_MODULE::GetBoundingBox()
text_area = GetTextRect();
textstart = text_area.GetOrigin();
textend = text_area.GetEnd();
RotatePoint( &textstart, m_Pos, angle);
RotatePoint( &textend, m_Pos, angle);
RotatePoint( &textstart, m_Pos, angle );
RotatePoint( &textend, m_Pos, angle );
text_area.SetOrigin(textstart);
text_area.SetEnd(textend);
text_area.SetOrigin( textstart );
text_area.SetEnd( textend );
text_area.Normalize();
return text_area;
}
/******************************************************************************************/
void TEXTE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, const wxPoint& offset )
/******************************************************************************************/
......@@ -393,7 +485,8 @@ void TEXTE_MODULE::Display_Infos( WinEDA_DrawFrame* frame )
wxASSERT( board );
static const wxString text_type_msg[3] = {
_( "Ref." ), _( "Value" ), _( "Text" ) };
_( "Ref." ), _( "Value" ), _( "Text" )
};
frame->MsgPanel->EraseMsgBox();
......@@ -409,11 +502,11 @@ void TEXTE_MODULE::Display_Infos( WinEDA_DrawFrame* frame )
Affiche_1_Parametre( frame, 20, _( "Type" ), text_type_msg[ii], DARKGREEN );
Affiche_1_Parametre( frame, 25, _( "Display" ), wxEmptyString, DARKGREEN );
if( m_NoShow )
Affiche_1_Parametre( frame, -1, wxEmptyString, _( "No" ), DARKGREEN );
msg = _( "No" );
else
Affiche_1_Parametre( frame, -1, wxEmptyString, _( "Yes" ), DARKGREEN );
msg = _( "Yes" );
Affiche_1_Parametre( frame, 25, _( "Display" ), msg, DARKGREEN );
ii = m_Layer;
if( ii < NB_LAYERS )
......@@ -431,16 +524,16 @@ void TEXTE_MODULE::Display_Infos( WinEDA_DrawFrame* frame )
Affiche_1_Parametre( frame, 36, _( "Mirror" ), msg, DARKGREEN );
msg.Printf( wxT( "%.1f" ), (float) m_Orient / 10 );
Affiche_1_Parametre( frame, 42, _( "Orient" ), msg, DARKGREEN );
Affiche_1_Parametre( frame, 43, _( "Orient" ), msg, DARKGREEN );
valeur_param( m_Width, msg );
Affiche_1_Parametre( frame, 48, _( "Width" ), msg, DARKGREEN );
Affiche_1_Parametre( frame, 51, _( "Width" ), msg, DARKGREEN );
valeur_param( m_Size.x, msg );
Affiche_1_Parametre( frame, 56, _( "H Size" ), msg, RED );
Affiche_1_Parametre( frame, 60, _( "H Size" ), msg, RED );
valeur_param( m_Size.y, msg );
Affiche_1_Parametre( frame, 64, _( "V Size" ), msg, RED );
Affiche_1_Parametre( frame, 69, _( "V Size" ), msg, RED );
}
......@@ -459,7 +552,6 @@ bool TEXTE_MODULE::IsOnLayer( int aLayer ) const
if( m_Layer==ADHESIVE_N_CU || m_Layer==SILKSCREEN_N_CU )
return true;
}
else if( aLayer == CMP_N )
{
if( m_Layer==ADHESIVE_N_CMP || m_Layer==SILKSCREEN_N_CMP )
......@@ -471,14 +563,15 @@ bool TEXTE_MODULE::IsOnLayer( int aLayer ) const
/* see class_text_mod.h
bool TEXTE_MODULE::IsOnOneOfTheseLayers( int aLayerMask ) const
{
* bool TEXTE_MODULE::IsOnOneOfTheseLayers( int aLayerMask ) const
* {
*
* }
*/
}
*/
#if defined (DEBUG)
#if defined(DEBUG)
/**
* Function Show
* is used to output the object tree, currently for debugging only.
......@@ -494,4 +587,6 @@ void TEXTE_MODULE::Show( int nestLevel, std::ostream& os )
// NestedSpace( nestLevel, os ) << "</" << GetClass().Lower().mb_str() << ">\n";
}
#endif
......@@ -59,7 +59,7 @@ public:
/** Function GetTextRect
* @return an EDA_Rect which gives the position and size of the text area (for the 0 orient text and footprint)
*/
EDA_Rect GetTextRect(void);
EDA_Rect GetTextRect( void );
/**
* Function GetBoundingBox
......@@ -68,6 +68,7 @@ public:
EDA_Rect GetBoundingBox();
void SetDrawCoord(); // mise a jour des coordonn�s absolues de trac�
// a partir des coord relatives
void SetLocalCoord(); // mise a jour des coordonn�s relatives
......@@ -80,11 +81,21 @@ public:
*/
bool Save( FILE* aFile ) const;
int ReadDescr( FILE* File, int* LineNum = NULL );
/**
* Function ReadLineDescr
* Read description from a given line in "*.brd" format.
* @param aLine The current line which contains the first line of description.
* @param aLine The FILE to read next lines (currently not used).
* @param LineNum a point to the line count (currently not used).
* @return int - > 0 if success reading else 0.
*/
int ReadDescr( char* aLine, FILE* aFile, int* aLineNum = NULL );
/* drawing functions */
void Draw( WinEDA_DrawPanel* panel, wxDC* DC, int aDrawMode, const wxPoint& offset = ZeroOffset );
void Draw( WinEDA_DrawPanel* panel,
wxDC* DC,
int aDrawMode,
const wxPoint& offset = ZeroOffset );
/**
......@@ -124,12 +135,10 @@ public:
* virtual inheritance from BOARD_ITEM.
* @param aLayerMask The bit-mapped set of layers to test for.
* @return bool - true if on one of the given layers, else false.
bool IsOnOneOfTheseLayers( int aLayerMask ) const;
* bool IsOnOneOfTheseLayers( int aLayerMask ) const;
*/
/**
* Function GetClass
* returns the class name.
......@@ -140,7 +149,9 @@ public:
return wxT( "MTEXT" );
}
#if defined(DEBUG)
#if defined (DEBUG)
/**
* Function Show
* is used to output the object tree, currently for debugging only.
......@@ -149,8 +160,8 @@ public:
* @param os The ostream& to output to.
*/
virtual void Show( int nestLevel, std::ostream& os );
#endif
};
#endif // TEXT_MODULE_H
......@@ -108,10 +108,12 @@ void WinEDA_DrawPanel::PrintPage( wxDC* DC, bool Print_Sheet_Ref, int printmaskl
Plot_Module( this, DC, Module, drawmode, printmasklayer );
}
/* draw the via holes */
/* draw the via holes in white color*/
pt_piste = Pcb->m_Track;
int rayon = g_DesignSettings.m_ViaDrill / 2;
int color = WHITE;
bool blackpenstate = GetGRForceBlackPenState( );
GRForceBlackPen( FALSE );
for( ; pt_piste != NULL; pt_piste = (TRACK*) pt_piste->Pnext )
{
if( ( printmasklayer & pt_piste->ReturnMaskLayer() ) == 0 )
......@@ -123,6 +125,7 @@ void WinEDA_DrawPanel::PrintPage( wxDC* DC, bool Print_Sheet_Ref, int printmaskl
rayon, 0, color, color );
}
}
GRForceBlackPen( blackpenstate );
if( Print_Sheet_Ref )
m_Parent->TraceWorkSheet( DC, ActiveScreen, 0 );
......@@ -159,7 +162,7 @@ static void Plot_Module( WinEDA_DrawPanel* panel, wxDC* DC,
pt_pad->Draw( panel, DC, draw_mode );
((WinEDA_BasePcbFrame*)panel->m_Parent)->m_DisplayPadFill = tmp_fill;
}
else // on copper layer, draw pads accordint to current options
else // on copper layer, draw pads according to current options
pt_pad->Draw( panel, DC, draw_mode );
}
......
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