2007-06-05 12:10:51 +00:00
|
|
|
/************************************/
|
|
|
|
/* fonctions de la classe COTATION */
|
|
|
|
/************************************/
|
|
|
|
|
|
|
|
#include "fctsys.h"
|
|
|
|
#include "gr_basic.h"
|
|
|
|
|
|
|
|
#include "common.h"
|
|
|
|
#include "pcbnew.h"
|
2007-08-08 20:51:08 +00:00
|
|
|
#include "trigo.h"
|
2007-08-20 19:33:15 +00:00
|
|
|
#include "wxstruct.h"
|
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-08-23 04:28:46 +00:00
|
|
|
COTATION::COTATION( BOARD_ITEM* StructFather ) :
|
|
|
|
BOARD_ITEM( StructFather, TYPECOTATION )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-08-08 20:51:08 +00:00
|
|
|
m_Layer = DRAW_LAYER;
|
|
|
|
m_Width = 50;
|
|
|
|
m_Value = 0;
|
|
|
|
m_Shape = 0;
|
|
|
|
m_Unit = INCHES;
|
|
|
|
m_Text = new TEXTE_PCB( this );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-08-08 20:51:08 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
/* Effacement memoire de la structure */
|
2007-08-23 04:28:46 +00:00
|
|
|
COTATION::~COTATION()
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-08-08 20:51:08 +00:00
|
|
|
delete m_Text;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-08-08 20:51:08 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
/* supprime du chainage la structure Struct
|
2007-08-08 20:51:08 +00:00
|
|
|
* les structures arrieres et avant sont chainees directement
|
2007-06-05 12:10:51 +00:00
|
|
|
*/
|
2007-09-01 12:00:30 +00:00
|
|
|
void COTATION::UnLink()
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-08-08 20:51:08 +00:00
|
|
|
/* Modification du chainage arriere */
|
|
|
|
if( Pback )
|
|
|
|
{
|
2007-09-01 12:00:30 +00:00
|
|
|
if( Pback->Type() != TYPEPCB )
|
2007-08-08 20:51:08 +00:00
|
|
|
{
|
|
|
|
Pback->Pnext = Pnext;
|
|
|
|
}
|
|
|
|
else /* Le chainage arriere pointe sur la structure "Pere" */
|
|
|
|
{
|
2007-08-23 04:28:46 +00:00
|
|
|
( (BOARD*) Pback )->m_Drawings = (BOARD_ITEM*) Pnext;
|
2007-08-08 20:51:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Modification du chainage avant */
|
|
|
|
if( Pnext )
|
|
|
|
Pnext->Pback = Pback;
|
|
|
|
|
|
|
|
Pnext = Pback = NULL;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-08-08 20:51:08 +00:00
|
|
|
|
2007-09-25 08:23:53 +00:00
|
|
|
/* Setup the dimension text */
|
2007-08-08 20:51:08 +00:00
|
|
|
void COTATION:: SetText( const wxString& NewText )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-08-08 20:51:08 +00:00
|
|
|
m_Text->m_Text = NewText;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-09-25 08:23:53 +00:00
|
|
|
/**********************************/
|
|
|
|
wxString COTATION:: GetText( void )
|
|
|
|
/**********************************/
|
|
|
|
/* Reutun the dimension text
|
|
|
|
*/
|
|
|
|
{
|
|
|
|
return m_Text->m_Text;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
/*************************************/
|
2007-08-08 20:51:08 +00:00
|
|
|
void COTATION::Copy( COTATION* source )
|
2007-06-05 12:10:51 +00:00
|
|
|
/*************************************/
|
|
|
|
{
|
2007-08-08 20:51:08 +00:00
|
|
|
m_Value = source->m_Value;
|
2007-08-23 04:28:46 +00:00
|
|
|
SetLayer( source->GetLayer() );
|
2007-08-08 20:51:08 +00:00
|
|
|
m_Width = source->m_Width;
|
|
|
|
m_Pos = source->m_Pos;
|
|
|
|
m_Shape = source->m_Shape;
|
|
|
|
m_Unit = source->m_Unit;
|
|
|
|
m_TimeStamp = GetTimeStamp();
|
|
|
|
m_Text->Copy( source->m_Text );
|
|
|
|
|
|
|
|
Barre_ox = source->Barre_ox; Barre_oy = source->Barre_oy;
|
|
|
|
Barre_fx = source->Barre_fx; Barre_fy = source->Barre_fy;
|
|
|
|
TraitG_ox = source->TraitG_ox; TraitG_oy = source->TraitG_oy;
|
|
|
|
TraitG_fx = source->TraitG_fx; TraitG_fy = source->TraitG_fy;
|
|
|
|
TraitD_ox = source->TraitD_ox; TraitD_oy = source->TraitD_oy;
|
|
|
|
TraitD_fx = source->TraitD_fx; TraitD_fy = source->TraitD_fy;
|
|
|
|
FlecheD1_ox = source->FlecheD1_ox; FlecheD1_oy = source->FlecheD1_oy;
|
|
|
|
FlecheD1_fx = source->FlecheD1_fx; FlecheD1_fy = source->FlecheD1_fy;
|
|
|
|
FlecheD2_ox = source->FlecheD2_ox; FlecheD2_oy = source->FlecheD2_oy;
|
|
|
|
FlecheD2_fx = source->FlecheD2_fx; FlecheD2_fy = source->FlecheD2_fy;
|
|
|
|
FlecheG1_ox = source->FlecheG1_ox; FlecheG1_oy = source->FlecheG1_oy;
|
|
|
|
FlecheG1_fx = source->FlecheG1_fx; FlecheG1_fy = source->FlecheG1_fy;
|
|
|
|
FlecheG2_ox = source->FlecheG2_ox; FlecheG2_oy = source->FlecheG2_oy;
|
|
|
|
FlecheG2_fx = source->FlecheG2_fx; FlecheG2_fy = source->FlecheG2_fy;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***************************************************************/
|
2007-08-08 20:51:08 +00:00
|
|
|
bool COTATION::ReadCotationDescr( FILE* File, int* LineNum )
|
2007-06-05 12:10:51 +00:00
|
|
|
/***************************************************************/
|
|
|
|
{
|
2007-08-08 20:51:08 +00:00
|
|
|
char Line[2048], Text[2048];
|
|
|
|
|
|
|
|
while( GetLine( File, Line, LineNum ) != NULL )
|
|
|
|
{
|
|
|
|
if( strnicmp( Line, "$EndCOTATION", 4 ) == 0 )
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
if( Line[0] == 'V' )
|
|
|
|
{
|
|
|
|
sscanf( Line + 2, " %d", &m_Value );
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( Line[0] == 'G' )
|
|
|
|
{
|
2007-08-23 04:28:46 +00:00
|
|
|
int layer;
|
|
|
|
|
|
|
|
sscanf( Line + 2, " %d %d %lX", &m_Shape, &layer, &m_TimeStamp );
|
2007-08-08 20:51:08 +00:00
|
|
|
|
|
|
|
/* Mise a jour des param .layer des sous structures */
|
2007-08-23 04:28:46 +00:00
|
|
|
if( layer < FIRST_NO_COPPER_LAYER )
|
|
|
|
layer = FIRST_NO_COPPER_LAYER;
|
|
|
|
if( layer > LAST_NO_COPPER_LAYER )
|
|
|
|
layer = LAST_NO_COPPER_LAYER;
|
2007-08-08 20:51:08 +00:00
|
|
|
|
2007-08-23 04:28:46 +00:00
|
|
|
SetLayer( layer );
|
|
|
|
m_Text->SetLayer( layer );
|
2007-08-08 20:51:08 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( Line[0] == 'T' )
|
|
|
|
{
|
|
|
|
ReadDelimitedText( Text, Line + 2, sizeof(Text) );
|
|
|
|
m_Text->m_Text = CONV_FROM_UTF8( Text );
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( Line[0] == 'P' )
|
|
|
|
{
|
|
|
|
sscanf( Line + 2, " %d %d %d %d %d %d %d",
|
|
|
|
&m_Text->m_Pos.x, &m_Text->m_Pos.y,
|
|
|
|
&m_Text->m_Size.x, &m_Text->m_Size.y,
|
|
|
|
&m_Text->m_Width, &m_Text->m_Orient,
|
|
|
|
&m_Text->m_Miroir );
|
|
|
|
|
|
|
|
m_Pos = m_Text->m_Pos;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( Line[0] == 'S' )
|
|
|
|
{
|
|
|
|
switch( Line[1] )
|
|
|
|
{
|
|
|
|
int Dummy;
|
|
|
|
|
|
|
|
case 'b':
|
|
|
|
sscanf( Line + 2, " %d %d %d %d %d %d",
|
|
|
|
&Dummy,
|
|
|
|
&Barre_ox, &Barre_oy,
|
|
|
|
&Barre_fx, &Barre_fy,
|
|
|
|
&m_Width );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'd':
|
|
|
|
sscanf( Line + 2, " %d %d %d %d %d %d",
|
|
|
|
&Dummy,
|
|
|
|
&TraitD_ox, &TraitD_oy,
|
|
|
|
&TraitD_fx, &TraitD_fy,
|
|
|
|
&Dummy );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'g':
|
|
|
|
sscanf( Line + 2, " %d %d %d %d %d %d",
|
|
|
|
&Dummy,
|
|
|
|
&TraitG_ox, &TraitG_oy,
|
|
|
|
&TraitG_fx, &TraitG_fy,
|
|
|
|
&Dummy );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case '1':
|
|
|
|
sscanf( Line + 2, " %d %d %d %d %d %d",
|
|
|
|
&Dummy,
|
|
|
|
&FlecheD1_ox, &FlecheD1_oy,
|
|
|
|
&FlecheD1_fx, &FlecheD1_fy,
|
|
|
|
&Dummy );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case '2':
|
|
|
|
sscanf( Line + 2, " %d %d %d %d %d %d",
|
|
|
|
&Dummy,
|
|
|
|
&FlecheD2_ox, &FlecheD2_oy,
|
|
|
|
&FlecheD2_fx, &FlecheD2_fy,
|
|
|
|
&Dummy );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case '3':
|
|
|
|
sscanf( Line + 2, " %d %d %d %d %d %d\n",
|
|
|
|
&Dummy,
|
|
|
|
&FlecheG1_ox, &FlecheG1_oy,
|
|
|
|
&FlecheG1_fx, &FlecheG1_fy,
|
|
|
|
&Dummy );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case '4':
|
|
|
|
sscanf( Line + 2, " %d %d %d %d %d %d",
|
|
|
|
&Dummy,
|
|
|
|
&FlecheG2_ox, &FlecheG2_oy,
|
|
|
|
&FlecheG2_fx, &FlecheG2_fy,
|
|
|
|
&Dummy );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-30 21:30:58 +00:00
|
|
|
#if 0
|
2007-06-05 12:10:51 +00:00
|
|
|
/**************************************************/
|
2007-08-08 20:51:08 +00:00
|
|
|
bool COTATION::WriteCotationDescr( FILE* File )
|
2007-06-05 12:10:51 +00:00
|
|
|
/**************************************************/
|
|
|
|
{
|
2007-08-08 20:51:08 +00:00
|
|
|
if( GetState( DELETED ) )
|
|
|
|
return FALSE;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-08-08 20:51:08 +00:00
|
|
|
fprintf( File, "$COTATION\n" );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-08-08 20:51:08 +00:00
|
|
|
fprintf( File, "Ge %d %d %lX\n", m_Shape,
|
|
|
|
m_Layer, m_TimeStamp );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-08-08 20:51:08 +00:00
|
|
|
fprintf( File, "Va %d\n", m_Value );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-08-08 20:51:08 +00:00
|
|
|
if( !m_Text->m_Text.IsEmpty() )
|
|
|
|
fprintf( File, "Te \"%s\"\n", CONV_TO_UTF8( m_Text->m_Text ) );
|
|
|
|
else
|
|
|
|
fprintf( File, "Te \"?\"\n" );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-08-08 20:51:08 +00:00
|
|
|
fprintf( File, "Po %d %d %d %d %d %d %d\n",
|
|
|
|
m_Text->m_Pos.x, m_Text->m_Pos.y,
|
|
|
|
m_Text->m_Size.x, m_Text->m_Size.y,
|
|
|
|
m_Text->m_Width, m_Text->m_Orient,
|
|
|
|
m_Text->m_Miroir );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-08-08 20:51:08 +00:00
|
|
|
fprintf( File, "Sb %d %d %d %d %d %d\n", S_SEGMENT,
|
|
|
|
Barre_ox, Barre_oy,
|
|
|
|
Barre_fx, Barre_fy, m_Width );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-08-08 20:51:08 +00:00
|
|
|
fprintf( File, "Sd %d %d %d %d %d %d\n", S_SEGMENT,
|
|
|
|
TraitD_ox, TraitD_oy,
|
|
|
|
TraitD_fx, TraitD_fy, m_Width );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-08-08 20:51:08 +00:00
|
|
|
fprintf( File, "Sg %d %d %d %d %d %d\n", S_SEGMENT,
|
|
|
|
TraitG_ox, TraitG_oy,
|
|
|
|
TraitG_fx, TraitG_fy, m_Width );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-08-08 20:51:08 +00:00
|
|
|
fprintf( File, "S1 %d %d %d %d %d %d\n", S_SEGMENT,
|
|
|
|
FlecheD1_ox, FlecheD1_oy,
|
|
|
|
FlecheD1_fx, FlecheD1_fy, m_Width );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-08-08 20:51:08 +00:00
|
|
|
fprintf( File, "S2 %d %d %d %d %d %d\n", S_SEGMENT,
|
|
|
|
FlecheD2_ox, FlecheD2_oy,
|
|
|
|
FlecheD2_fx, FlecheD2_fy, m_Width );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
2007-08-08 20:51:08 +00:00
|
|
|
fprintf( File, "S3 %d %d %d %d %d %d\n", S_SEGMENT,
|
|
|
|
FlecheG1_ox, FlecheG1_oy,
|
|
|
|
FlecheG1_fx, FlecheG1_fy, m_Width );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-08-08 20:51:08 +00:00
|
|
|
fprintf( File, "S4 %d %d %d %d %d %d\n", S_SEGMENT,
|
|
|
|
FlecheG2_ox, FlecheG2_oy,
|
|
|
|
FlecheG2_fx, FlecheG2_fy, m_Width );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-08-08 20:51:08 +00:00
|
|
|
fprintf( File, "$EndCOTATION\n" );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-08-08 20:51:08 +00:00
|
|
|
return 1;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
2007-10-30 21:30:58 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
bool COTATION::Save( FILE* aFile ) const
|
|
|
|
{
|
|
|
|
if( GetState( DELETED ) )
|
|
|
|
return true;
|
|
|
|
|
|
|
|
bool rc = false;
|
|
|
|
|
|
|
|
if( fprintf( aFile, "$COTATION\n" ) != sizeof("$COTATION\n")-1 )
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
fprintf( aFile, "Ge %d %d %lX\n", m_Shape, m_Layer, m_TimeStamp );
|
|
|
|
|
|
|
|
fprintf( aFile, "Va %d\n", m_Value );
|
|
|
|
|
|
|
|
if( !m_Text->m_Text.IsEmpty() )
|
|
|
|
fprintf( aFile, "Te \"%s\"\n", CONV_TO_UTF8( m_Text->m_Text ) );
|
|
|
|
else
|
|
|
|
fprintf( aFile, "Te \"?\"\n" );
|
|
|
|
|
|
|
|
fprintf( aFile, "Po %d %d %d %d %d %d %d\n",
|
|
|
|
m_Text->m_Pos.x, m_Text->m_Pos.y,
|
|
|
|
m_Text->m_Size.x, m_Text->m_Size.y,
|
|
|
|
m_Text->m_Width, m_Text->m_Orient,
|
|
|
|
m_Text->m_Miroir );
|
|
|
|
|
|
|
|
fprintf( aFile, "Sb %d %d %d %d %d %d\n", S_SEGMENT,
|
|
|
|
Barre_ox, Barre_oy,
|
|
|
|
Barre_fx, Barre_fy, m_Width );
|
|
|
|
|
|
|
|
fprintf( aFile, "Sd %d %d %d %d %d %d\n", S_SEGMENT,
|
|
|
|
TraitD_ox, TraitD_oy,
|
|
|
|
TraitD_fx, TraitD_fy, m_Width );
|
|
|
|
|
|
|
|
fprintf( aFile, "Sg %d %d %d %d %d %d\n", S_SEGMENT,
|
|
|
|
TraitG_ox, TraitG_oy,
|
|
|
|
TraitG_fx, TraitG_fy, m_Width );
|
|
|
|
|
|
|
|
fprintf( aFile, "S1 %d %d %d %d %d %d\n", S_SEGMENT,
|
|
|
|
FlecheD1_ox, FlecheD1_oy,
|
|
|
|
FlecheD1_fx, FlecheD1_fy, m_Width );
|
|
|
|
|
|
|
|
fprintf( aFile, "S2 %d %d %d %d %d %d\n", S_SEGMENT,
|
|
|
|
FlecheD2_ox, FlecheD2_oy,
|
|
|
|
FlecheD2_fx, FlecheD2_fy, m_Width );
|
|
|
|
|
|
|
|
|
|
|
|
fprintf( aFile, "S3 %d %d %d %d %d %d\n", S_SEGMENT,
|
|
|
|
FlecheG1_ox, FlecheG1_oy,
|
|
|
|
FlecheG1_fx, FlecheG1_fy, m_Width );
|
|
|
|
|
|
|
|
fprintf( aFile, "S4 %d %d %d %d %d %d\n", S_SEGMENT,
|
|
|
|
FlecheG2_ox, FlecheG2_oy,
|
|
|
|
FlecheG2_fx, FlecheG2_fy, m_Width );
|
|
|
|
|
|
|
|
if( fprintf( aFile, "$EndCOTATION\n" ) != sizeof("$EndCOTATION\n")-1 )
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
rc = true;
|
|
|
|
|
|
|
|
out:
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
|
|
|
/************************************************************************/
|
2007-08-08 20:51:08 +00:00
|
|
|
void COTATION::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
|
|
|
|
const wxPoint& offset, int mode_color )
|
2007-06-05 12:10:51 +00:00
|
|
|
/************************************************************************/
|
2007-08-08 20:51:08 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
/* impression de 1 cotation : serie de n segments + 1 texte
|
2007-08-08 20:51:08 +00:00
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-08-08 20:51:08 +00:00
|
|
|
int ox, oy, typeaff, width, gcolor;
|
|
|
|
int zoom = panel->GetScreen()->GetZoom();
|
|
|
|
|
|
|
|
ox = offset.x;
|
|
|
|
oy = offset.y;
|
|
|
|
|
|
|
|
m_Text->Draw( panel, DC, offset, mode_color );
|
|
|
|
|
|
|
|
gcolor = g_DesignSettings.m_LayerColor[m_Layer];
|
|
|
|
if( (gcolor & ITEM_NOT_SHOW) != 0 )
|
|
|
|
return;
|
|
|
|
|
|
|
|
GRSetDrawMode( DC, mode_color );
|
|
|
|
typeaff = DisplayOpt.DisplayDrawItems;
|
|
|
|
|
|
|
|
width = m_Width;
|
|
|
|
if( width / zoom < 2 )
|
|
|
|
typeaff = FILAIRE;
|
|
|
|
|
|
|
|
switch( typeaff )
|
|
|
|
{
|
|
|
|
case FILAIRE:
|
|
|
|
width = 0;
|
|
|
|
|
|
|
|
case FILLED:
|
|
|
|
GRLine( &panel->m_ClipBox, DC,
|
|
|
|
Barre_ox - ox, Barre_oy - oy,
|
|
|
|
Barre_fx - ox, Barre_fy - oy, width, gcolor );
|
|
|
|
GRLine( &panel->m_ClipBox, DC,
|
|
|
|
TraitG_ox - ox, TraitG_oy - oy,
|
|
|
|
TraitG_fx - ox, TraitG_fy - oy, width, gcolor );
|
|
|
|
GRLine( &panel->m_ClipBox, DC,
|
|
|
|
TraitD_ox - ox, TraitD_oy - oy,
|
|
|
|
TraitD_fx - ox, TraitD_fy - oy, width, gcolor );
|
|
|
|
GRLine( &panel->m_ClipBox, DC,
|
|
|
|
FlecheD1_ox - ox, FlecheD1_oy - oy,
|
|
|
|
FlecheD1_fx - ox, FlecheD1_fy - oy, width, gcolor );
|
|
|
|
GRLine( &panel->m_ClipBox, DC,
|
|
|
|
FlecheD2_ox - ox, FlecheD2_oy - oy,
|
|
|
|
FlecheD2_fx - ox, FlecheD2_fy - oy, width, gcolor );
|
|
|
|
GRLine( &panel->m_ClipBox, DC,
|
|
|
|
FlecheG1_ox - ox, FlecheG1_oy - oy,
|
|
|
|
FlecheG1_fx - ox, FlecheG1_fy - oy, width, gcolor );
|
|
|
|
GRLine( &panel->m_ClipBox, DC,
|
|
|
|
FlecheG2_ox - ox, FlecheG2_oy - oy,
|
|
|
|
FlecheG2_fx - ox, FlecheG2_fy - oy, width, gcolor );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SKETCH:
|
|
|
|
GRCSegm( &panel->m_ClipBox, DC,
|
|
|
|
Barre_ox - ox, Barre_oy - oy,
|
|
|
|
Barre_fx - ox, Barre_fy - oy,
|
|
|
|
width, gcolor );
|
|
|
|
GRCSegm( &panel->m_ClipBox, DC,
|
|
|
|
TraitG_ox - ox, TraitG_oy - oy,
|
|
|
|
TraitG_fx - ox, TraitG_fy - oy,
|
|
|
|
width, gcolor );
|
|
|
|
GRCSegm( &panel->m_ClipBox, DC,
|
|
|
|
TraitD_ox - ox, TraitD_oy - oy,
|
|
|
|
TraitD_fx - ox, TraitD_fy - oy,
|
|
|
|
width, gcolor );
|
|
|
|
GRCSegm( &panel->m_ClipBox, DC,
|
|
|
|
FlecheD1_ox - ox, FlecheD1_oy - oy,
|
|
|
|
FlecheD1_fx - ox, FlecheD1_fy - oy,
|
|
|
|
width, gcolor );
|
|
|
|
GRCSegm( &panel->m_ClipBox, DC,
|
|
|
|
FlecheD2_ox - ox, FlecheD2_oy - oy,
|
|
|
|
FlecheD2_fx - ox, FlecheD2_fy - oy,
|
|
|
|
width, gcolor );
|
|
|
|
GRCSegm( &panel->m_ClipBox, DC,
|
|
|
|
FlecheG1_ox - ox, FlecheG1_oy - oy,
|
|
|
|
FlecheG1_fx - ox, FlecheG1_fy - oy,
|
|
|
|
width, gcolor );
|
|
|
|
GRCSegm( &panel->m_ClipBox, DC,
|
|
|
|
FlecheG2_ox - ox, FlecheG2_oy - oy,
|
|
|
|
FlecheG2_fx - ox, FlecheG2_fy - oy,
|
|
|
|
width, gcolor );
|
|
|
|
break;
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-08-20 19:33:15 +00:00
|
|
|
// see class_cotation.h
|
|
|
|
void COTATION::Display_Infos( WinEDA_DrawFrame* frame )
|
|
|
|
{
|
|
|
|
// for now, display only the text within the COTATION using class TEXTE_PCB.
|
|
|
|
m_Text->Display_Infos( frame );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-08-08 20:51:08 +00:00
|
|
|
/**
|
|
|
|
* Function HitTest
|
|
|
|
* tests if the given wxPoint is within the bounds of this object.
|
|
|
|
* @param ref_pos A wxPoint to test
|
|
|
|
* @return bool - true if a hit, else false
|
|
|
|
*/
|
|
|
|
bool COTATION::HitTest( const wxPoint& ref_pos )
|
|
|
|
{
|
|
|
|
int ux0, uy0;
|
|
|
|
int dx, dy, spot_cX, spot_cY;
|
|
|
|
|
|
|
|
if( m_Text )
|
|
|
|
{
|
|
|
|
// because HitTest() is present in both base classes of TEXTE_PCB
|
|
|
|
// use a clarifying cast to tell compiler which HitTest()
|
|
|
|
// to call.
|
|
|
|
if( static_cast<EDA_TextStruct*>(m_Text)->HitTest( ref_pos ) )
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Localisation des SEGMENTS ?) */
|
|
|
|
ux0 = Barre_ox;
|
|
|
|
uy0 = Barre_oy;
|
|
|
|
|
|
|
|
/* recalcul des coordonnees avec ux0, uy0 = origine des coordonnees */
|
|
|
|
dx = Barre_fx - ux0;
|
|
|
|
dy = Barre_fy - uy0;
|
|
|
|
|
|
|
|
spot_cX = ref_pos.x - ux0;
|
|
|
|
spot_cY = ref_pos.y - uy0;
|
|
|
|
|
|
|
|
if( DistanceTest( m_Width / 2, dx, dy, spot_cX, spot_cY ) )
|
|
|
|
return true;
|
|
|
|
|
|
|
|
ux0 = TraitG_ox;
|
|
|
|
uy0 = TraitG_oy;
|
|
|
|
|
|
|
|
/* recalcul des coordonnees avec ux0, uy0 = origine des coordonnees */
|
|
|
|
dx = TraitG_fx - ux0;
|
|
|
|
dy = TraitG_fy - uy0;
|
|
|
|
|
|
|
|
spot_cX = ref_pos.x - ux0;
|
|
|
|
spot_cY = ref_pos.y - uy0;
|
|
|
|
|
|
|
|
/* detection : */
|
|
|
|
if( DistanceTest( m_Width / 2, dx, dy, spot_cX, spot_cY ) )
|
|
|
|
return true;
|
|
|
|
|
|
|
|
ux0 = TraitD_ox;
|
|
|
|
uy0 = TraitD_oy;
|
|
|
|
|
|
|
|
/* recalcul des coordonnees avec ux0, uy0 = origine des coordonnees */
|
|
|
|
dx = TraitD_fx - ux0;
|
|
|
|
dy = TraitD_fy - uy0;
|
|
|
|
|
|
|
|
spot_cX = ref_pos.x - ux0;
|
|
|
|
spot_cY = ref_pos.y - uy0;
|
|
|
|
|
|
|
|
/* detection : */
|
|
|
|
if( DistanceTest( m_Width / 2, dx, dy, spot_cX, spot_cY ) )
|
|
|
|
return true;
|
|
|
|
|
|
|
|
ux0 = FlecheD1_ox;
|
|
|
|
uy0 = FlecheD1_oy;
|
|
|
|
|
|
|
|
/* recalcul des coordonnees avec ux0, uy0 = origine des coordonnees */
|
|
|
|
dx = FlecheD1_fx - ux0;
|
|
|
|
dy = FlecheD1_fy - uy0;
|
|
|
|
|
|
|
|
spot_cX = ref_pos.x - ux0;
|
|
|
|
spot_cY = ref_pos.y - uy0;
|
|
|
|
|
|
|
|
/* detection : */
|
|
|
|
if( DistanceTest( m_Width / 2, dx, dy, spot_cX, spot_cY ) )
|
|
|
|
return true;
|
|
|
|
|
|
|
|
ux0 = FlecheD2_ox;
|
|
|
|
uy0 = FlecheD2_oy;
|
|
|
|
|
|
|
|
/* recalcul des coordonnees avec ux0, uy0 = origine des coordonnees */
|
|
|
|
dx = FlecheD2_fx - ux0;
|
|
|
|
dy = FlecheD2_fy - uy0;
|
|
|
|
|
|
|
|
spot_cX = ref_pos.x - ux0;
|
|
|
|
spot_cY = ref_pos.y - uy0;
|
|
|
|
|
|
|
|
if( DistanceTest( m_Width / 2, dx, dy, spot_cX, spot_cY ) )
|
|
|
|
return true;
|
|
|
|
|
|
|
|
ux0 = FlecheG1_ox;
|
|
|
|
uy0 = FlecheG1_oy;
|
|
|
|
|
|
|
|
/* recalcul des coordonnees avec ux0, uy0 = origine des coordonnees */
|
|
|
|
dx = FlecheG1_fx - ux0;
|
|
|
|
dy = FlecheG1_fy - uy0;
|
|
|
|
|
|
|
|
spot_cX = ref_pos.x - ux0;
|
|
|
|
spot_cY = ref_pos.y - uy0;
|
|
|
|
|
|
|
|
if( DistanceTest( m_Width / 2, dx, dy, spot_cX, spot_cY ) )
|
|
|
|
return true;
|
|
|
|
|
|
|
|
ux0 = FlecheG2_ox;
|
|
|
|
uy0 = FlecheG2_oy;
|
|
|
|
|
|
|
|
/* recalcul des coordonnees avec ux0, uy0 = origine des coordonnees */
|
|
|
|
dx = FlecheG2_fx - ux0;
|
|
|
|
dy = FlecheG2_fy - uy0;
|
|
|
|
|
|
|
|
spot_cX = ref_pos.x - ux0;
|
|
|
|
spot_cY = ref_pos.y - uy0;
|
|
|
|
|
|
|
|
if( DistanceTest( m_Width / 2, dx, dy, spot_cX, spot_cY ) )
|
|
|
|
return true;
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|