Commit 424aac6c authored by Lorenzo Marcantonio's avatar Lorenzo Marcantonio

TEXTE_MODULE cleanup in preparation for text on different layers

- Removed the friends MODULE and FOOTPRINT_EDIT_FRAME from TEXTE_MODULE
  (as in the @todo comment)

- Refactored the Rotate/Flip/Mirror for text in modules into the
  TEXTE_MODULE class itself (members RotateWithModule, FlipWithModule,
  MirrorWithModule)

- New behaviour in coloring text on screen: reference and value still
  take the color from the MOD_TEXT_FR_VISIBLE and MOD_TEXT_BK_VISIBLE
  visibles; other text takes the color of the layer containing it
  (except when hidden, obviously) but still get its visibility
  controlled by those visibles (probably the most intuitive and useful
  behaviour)

- Still need to decide: should text on a layer be hidden when the layer
  is? Probably yes (still to be implemented);

- Some comment fixed and many cast converted to static_cast
parent edb7cd60
...@@ -111,7 +111,7 @@ public: ...@@ -111,7 +111,7 @@ public:
* </p> * </p>
* @return a const wxString object containing the string of the item. * @return a const wxString object containing the string of the item.
*/ */
virtual const wxString GetText() const { return m_Text; } virtual const wxString& GetText() const { return m_Text; }
virtual void SetText( const wxString& aText ) { m_Text = aText; } virtual void SetText( const wxString& aText ) { m_Text = aText; }
......
...@@ -461,11 +461,7 @@ void MoveMarkedItems( MODULE* module, wxPoint offset ) ...@@ -461,11 +461,7 @@ void MoveMarkedItems( MODULE* module, wxPoint offset )
switch( item->Type() ) switch( item->Type() )
{ {
case PCB_MODULE_TEXT_T: case PCB_MODULE_TEXT_T:
{ static_cast<TEXTE_MODULE*>( item )->Move( offset );
TEXTE_MODULE* tm = (TEXTE_MODULE*) item;
tm->Offset( offset );
tm->SetPos0( tm->GetPos0() + offset );
}
break; break;
case PCB_MODULE_EDGE_T: case PCB_MODULE_EDGE_T:
...@@ -588,14 +584,7 @@ void MirrorMarkedItems( MODULE* module, wxPoint offset, bool force_all ) ...@@ -588,14 +584,7 @@ void MirrorMarkedItems( MODULE* module, wxPoint offset, bool force_all )
break; break;
case PCB_MODULE_TEXT_T: case PCB_MODULE_TEXT_T:
{ static_cast<TEXTE_MODULE*>( item )->MirrorWithModule( offset.x );
TEXTE_MODULE* tm = (TEXTE_MODULE*) item;
tmp = tm->GetTextPosition();
SETMIRROR( tmp.x );
tm->SetTextPosition( tmp );
tmp.y = tm->GetPos0().y;
tm->SetPos0( tmp );
}
break; break;
default: default:
...@@ -655,18 +644,11 @@ void RotateMarkedItems( MODULE* module, wxPoint offset, bool force_all ) ...@@ -655,18 +644,11 @@ void RotateMarkedItems( MODULE* module, wxPoint offset, bool force_all )
break; break;
case PCB_MODULE_TEXT_T: case PCB_MODULE_TEXT_T:
{ static_cast<TEXTE_MODULE*>( item )->RotateWithModule( wxPoint( 0, 0 ), 900 );
TEXTE_MODULE* tm = (TEXTE_MODULE*) item;
wxPoint pos = tm->GetTextPosition();
ROTATE( pos );
tm->SetTextPosition( pos );
tm->SetPos0( tm->GetTextPosition() );
tm->SetOrientation( tm->GetOrientation() + 900 );
}
break; break;
default: default:
; break;
} }
item->ClearFlags(); item->ClearFlags();
...@@ -742,7 +724,7 @@ int MarkItemsInBloc( MODULE* module, EDA_RECT& Rect ) ...@@ -742,7 +724,7 @@ int MarkItemsInBloc( MODULE* module, EDA_RECT& Rect )
break; break;
case PCB_MODULE_TEXT_T: case PCB_MODULE_TEXT_T:
pos = ( (TEXTE_MODULE*) item )->GetTextPosition(); pos = static_cast<TEXTE_MODULE*>( item )->GetTextPosition();
if( Rect.Contains( pos ) ) if( Rect.Contains( pos ) )
{ {
......
...@@ -168,9 +168,12 @@ void MODULE::TransformGraphicShapesWithClearanceToPolygonSet( ...@@ -168,9 +168,12 @@ void MODULE::TransformGraphicShapesWithClearanceToPolygonSet(
switch( item->Type() ) switch( item->Type() )
{ {
case PCB_MODULE_TEXT_T: case PCB_MODULE_TEXT_T:
if( ((TEXTE_MODULE*)item)->GetLayer() == aLayer ) {
texts.push_back( (TEXTE_MODULE *) item ); TEXTE_MODULE* text = static_cast<TEXTE_MODULE*>( item );
if( text->GetLayer() == aLayer )
texts.push_back( text );
break; break;
}
case PCB_MODULE_EDGE_T: case PCB_MODULE_EDGE_T:
outline = (EDGE_MODULE*) item; outline = (EDGE_MODULE*) item;
......
...@@ -168,8 +168,8 @@ void BOARD::Move( const wxPoint& aMoveVector ) // overload ...@@ -168,8 +168,8 @@ void BOARD::Move( const wxPoint& aMoveVector ) // overload
PCB_TARGET_T, PCB_TARGET_T,
PCB_VIA_T, PCB_VIA_T,
PCB_TRACE_T, PCB_TRACE_T,
// PCB_PAD_T, // PCB_PAD_T, Can't be at board level
// PCB_MODULE_TEXT_T, // PCB_MODULE_TEXT_T, Can't be at board level
PCB_MODULE_T, PCB_MODULE_T,
PCB_ZONE_AREA_T, PCB_ZONE_AREA_T,
EOT EOT
......
...@@ -72,8 +72,8 @@ MODULE::MODULE( BOARD* parent ) : ...@@ -72,8 +72,8 @@ MODULE::MODULE( BOARD* parent ) :
m_ThermalWidth = 0; // Use zone setting by default m_ThermalWidth = 0; // Use zone setting by default
m_ThermalGap = 0; // Use zone setting by default m_ThermalGap = 0; // Use zone setting by default
// These are special and mandatory text fields
m_Reference = new TEXTE_MODULE( this, TEXTE_MODULE::TEXT_is_REFERENCE ); m_Reference = new TEXTE_MODULE( this, TEXTE_MODULE::TEXT_is_REFERENCE );
m_Value = new TEXTE_MODULE( this, TEXTE_MODULE::TEXT_is_VALUE ); m_Value = new TEXTE_MODULE( this, TEXTE_MODULE::TEXT_is_VALUE );
// Reserve one void 3D entry, to avoid problems with void list // Reserve one void 3D entry, to avoid problems with void list
...@@ -131,7 +131,7 @@ MODULE::MODULE( const MODULE& aModule ) : ...@@ -131,7 +131,7 @@ MODULE::MODULE( const MODULE& aModule ) :
{ {
case PCB_MODULE_TEXT_T: case PCB_MODULE_TEXT_T:
case PCB_MODULE_EDGE_T: case PCB_MODULE_EDGE_T:
newItem = (BOARD_ITEM*)item->Clone(); newItem = static_cast<BOARD_ITEM*>( item->Clone() );
newItem->SetParent( this ); newItem->SetParent( this );
m_Drawings.PushBack( newItem ); m_Drawings.PushBack( newItem );
break; break;
...@@ -242,18 +242,21 @@ void MODULE::Copy( MODULE* aModule ) ...@@ -242,18 +242,21 @@ void MODULE::Copy( MODULE* aModule )
switch( item->Type() ) switch( item->Type() )
{ {
case PCB_MODULE_TEXT_T: case PCB_MODULE_TEXT_T:
TEXTE_MODULE * textm; {
textm = new TEXTE_MODULE( this ); TEXTE_MODULE* textm = new TEXTE_MODULE( this );
textm->Copy( (TEXTE_MODULE*) item ); textm->Copy( static_cast<TEXTE_MODULE*>( item ) );
m_Drawings.PushBack( textm ); m_Drawings.PushBack( textm );
break; break;
}
case PCB_MODULE_EDGE_T: case PCB_MODULE_EDGE_T:
{
EDGE_MODULE * edge; EDGE_MODULE * edge;
edge = new EDGE_MODULE( this ); edge = new EDGE_MODULE( this );
edge->Copy( (EDGE_MODULE*) item ); edge->Copy( (EDGE_MODULE*) item );
m_Drawings.PushBack( edge ); m_Drawings.PushBack( edge );
break; break;
}
default: default:
wxLogMessage( wxT( "MODULE::Copy() Internal Err: unknown type" ) ); wxLogMessage( wxT( "MODULE::Copy() Internal Err: unknown type" ) );
...@@ -299,9 +302,10 @@ void MODULE::Add( BOARD_ITEM* aBoardItem, bool doAppend ) ...@@ -299,9 +302,10 @@ void MODULE::Add( BOARD_ITEM* aBoardItem, bool doAppend )
switch( aBoardItem->Type() ) switch( aBoardItem->Type() )
{ {
case PCB_MODULE_TEXT_T: case PCB_MODULE_TEXT_T:
// Only common texts can be added this way. Reference and value are not hold in the DLIST. // Only user texts can be added this way. Reference and value are not hold in the DLIST.
assert( static_cast<TEXTE_MODULE*>( aBoardItem )->GetType() == TEXTE_MODULE::TEXT_is_DIVERS ); assert( static_cast<TEXTE_MODULE*>( aBoardItem )->GetType() == TEXTE_MODULE::TEXT_is_DIVERS );
/* no break */
// no break
case PCB_MODULE_EDGE_T: case PCB_MODULE_EDGE_T:
if( doAppend ) if( doAppend )
...@@ -337,9 +341,10 @@ BOARD_ITEM* MODULE::Remove( BOARD_ITEM* aBoardItem ) ...@@ -337,9 +341,10 @@ BOARD_ITEM* MODULE::Remove( BOARD_ITEM* aBoardItem )
switch( aBoardItem->Type() ) switch( aBoardItem->Type() )
{ {
case PCB_MODULE_TEXT_T: case PCB_MODULE_TEXT_T:
// Only common texts can be added this way. Reference and value are not hold in the DLIST. // Only user texts can be removed this way. Reference and value are not hold in the DLIST.
assert( static_cast<TEXTE_MODULE*>( aBoardItem )->GetType() == TEXTE_MODULE::TEXT_is_DIVERS ); assert( static_cast<TEXTE_MODULE*>( aBoardItem )->GetType() == TEXTE_MODULE::TEXT_is_DIVERS );
/* no break */
// no break
case PCB_MODULE_EDGE_T: case PCB_MODULE_EDGE_T:
return m_Drawings.Remove( static_cast<BOARD_ITEM*>( aBoardItem ) ); return m_Drawings.Remove( static_cast<BOARD_ITEM*>( aBoardItem ) );
...@@ -912,8 +917,6 @@ void MODULE::Rotate( const wxPoint& aRotCentre, double aAngle ) ...@@ -912,8 +917,6 @@ void MODULE::Rotate( const wxPoint& aRotCentre, double aAngle )
void MODULE::Flip( const wxPoint& aCentre ) void MODULE::Flip( const wxPoint& aCentre )
{ {
TEXTE_MODULE* text;
// Move module to its final position: // Move module to its final position:
wxPoint finalPos = m_Pos; wxPoint finalPos = m_Pos;
...@@ -933,24 +936,10 @@ void MODULE::Flip( const wxPoint& aCentre ) ...@@ -933,24 +936,10 @@ void MODULE::Flip( const wxPoint& aCentre )
pad->Flip( m_Pos ); pad->Flip( m_Pos );
// Mirror reference. // Mirror reference.
text = m_Reference; m_Reference->FlipWithModule( m_Pos.y );
text->m_Pos.y -= m_Pos.y;
NEGATE( text->m_Pos.y );
text->m_Pos.y += m_Pos.y;
NEGATE(text->m_Pos0.y);
NEGATE_AND_NORMALIZE_ANGLE_POS( text->m_Orient );
text->SetLayer( FlipLayer( text->GetLayer() ) );
text->m_Mirror = IsBackLayer( GetLayer() );
// Mirror value. // Mirror value.
text = m_Value; m_Value->FlipWithModule( m_Pos.y );
text->m_Pos.y -= m_Pos.y;
NEGATE( text->m_Pos.y );
text->m_Pos.y += m_Pos.y;
NEGATE( text->m_Pos0.y );
NEGATE_AND_NORMALIZE_ANGLE_POS( text->m_Orient );
text->SetLayer( FlipLayer( text->GetLayer() ) );
text->m_Mirror = IsBackLayer( GetLayer() );
// Reverse mirror module graphics and texts. // Reverse mirror module graphics and texts.
for( EDA_ITEM* item = m_Drawings; item; item = item->Next() ) for( EDA_ITEM* item = m_Drawings; item; item = item->Next() )
...@@ -986,14 +975,7 @@ void MODULE::Flip( const wxPoint& aCentre ) ...@@ -986,14 +975,7 @@ void MODULE::Flip( const wxPoint& aCentre )
break; break;
case PCB_MODULE_TEXT_T: case PCB_MODULE_TEXT_T:
text = (TEXTE_MODULE*) item; static_cast<TEXTE_MODULE*>( item )->FlipWithModule( m_Pos.y );
text->m_Pos.y -= m_Pos.y;
NEGATE( text->m_Pos.y );
text->m_Pos.y += m_Pos.y;
NEGATE( text->m_Pos0.y );
NEGATE_AND_NORMALIZE_ANGLE_POS( text->m_Orient );
text->SetLayer( FlipLayer( text->GetLayer() ) );
text->m_Mirror = IsBackLayer( GetLayer() );
break; break;
default: default:
...@@ -1032,8 +1014,8 @@ void MODULE::SetPosition( const wxPoint& newpos ) ...@@ -1032,8 +1014,8 @@ void MODULE::SetPosition( const wxPoint& newpos )
case PCB_MODULE_TEXT_T: case PCB_MODULE_TEXT_T:
{ {
TEXTE_MODULE* text = (TEXTE_MODULE*) item; TEXTE_MODULE* text = static_cast<TEXTE_MODULE*>( item );
text->m_Pos += delta; text->SetTextPosition( text->GetTextPosition() + delta );
break; break;
} }
...@@ -1083,19 +1065,21 @@ void MODULE::MoveAnchorPosition( const wxPoint& aMoveVector ) ...@@ -1083,19 +1065,21 @@ void MODULE::MoveAnchorPosition( const wxPoint& aMoveVector )
switch( item->Type() ) switch( item->Type() )
{ {
case PCB_MODULE_EDGE_T: case PCB_MODULE_EDGE_T:
#undef STRUCT {
#define STRUCT ( (EDGE_MODULE*) item ) EDGE_MODULE* edge = static_cast<EDGE_MODULE*>( item );
STRUCT->m_Start0 += moveVector; edge->m_Start0 += moveVector;
STRUCT->m_End0 += moveVector; edge->m_End0 += moveVector;
STRUCT->SetDrawCoord(); edge->SetDrawCoord();
break; break;
}
case PCB_MODULE_TEXT_T: case PCB_MODULE_TEXT_T:
#undef STRUCT {
#define STRUCT ( (TEXTE_MODULE*) item ) TEXTE_MODULE* text = static_cast<TEXTE_MODULE*>( item );
STRUCT->SetPos0( STRUCT->GetPos0() + moveVector ); text->SetPos0( text->GetPos0() + moveVector );
STRUCT->SetDrawCoord(); text->SetDrawCoord();
break; break;
}
default: default:
break; break;
...@@ -1135,14 +1119,12 @@ void MODULE::SetOrientation( double newangle ) ...@@ -1135,14 +1119,12 @@ void MODULE::SetOrientation( double newangle )
{ {
if( item->Type() == PCB_MODULE_EDGE_T ) if( item->Type() == PCB_MODULE_EDGE_T )
{ {
EDGE_MODULE* edge = (EDGE_MODULE*) item; static_cast<EDGE_MODULE*>( item )->SetDrawCoord();
edge->SetDrawCoord();
} }
else if( item->Type() == PCB_MODULE_TEXT_T ) else if( item->Type() == PCB_MODULE_TEXT_T )
{ {
TEXTE_MODULE* text = (TEXTE_MODULE*) item; static_cast<TEXTE_MODULE*>( item )->SetDrawCoord();
text->SetDrawCoord();
} }
} }
......
...@@ -365,7 +365,7 @@ public: ...@@ -365,7 +365,7 @@ public:
*/ */
const wxString& GetReference() const const wxString& GetReference() const
{ {
return m_Reference->m_Text; return m_Reference->GetText();
} }
/** /**
...@@ -375,7 +375,7 @@ public: ...@@ -375,7 +375,7 @@ public:
*/ */
void SetReference( const wxString& aReference ) void SetReference( const wxString& aReference )
{ {
m_Reference->m_Text = aReference; m_Reference->SetText( aReference );
} }
/** /**
...@@ -384,7 +384,7 @@ public: ...@@ -384,7 +384,7 @@ public:
*/ */
const wxString& GetValue() const wxString& GetValue()
{ {
return m_Value->m_Text; return m_Value->GetText();
} }
/** /**
...@@ -393,7 +393,7 @@ public: ...@@ -393,7 +393,7 @@ public:
*/ */
void SetValue( const wxString& aValue ) void SetValue( const wxString& aValue )
{ {
m_Value->m_Text = aValue; m_Value->SetText( aValue );
} }
/// read/write accessors: /// read/write accessors:
......
...@@ -102,6 +102,36 @@ void TEXTE_MODULE::Flip(const wxPoint& aCentre ) ...@@ -102,6 +102,36 @@ void TEXTE_MODULE::Flip(const wxPoint& aCentre )
} }
void TEXTE_MODULE::FlipWithModule( int aOffset )
{
m_Pos.y = aOffset - (m_Pos.y - aOffset);
NEGATE_AND_NORMALIZE_ANGLE_POS( m_Orient );
SetLayer( FlipLayer( GetLayer() ) );
m_Mirror = IsBackLayer( GetLayer() );
}
void TEXTE_MODULE::MirrorWithModule( int aOffset )
{
wxPoint tmp = GetTextPosition();
tmp.x = aOffset - (tmp.x - aOffset);
SetTextPosition( tmp );
tmp.y = GetPos0().y;
SetPos0( tmp );
NEGATE_AND_NORMALIZE_ANGLE_POS( m_Orient );
}
void TEXTE_MODULE::RotateWithModule( const wxPoint& aOffset, double aAngle )
{
wxPoint pos = GetTextPosition();
RotatePoint( &pos, aOffset, aAngle );
SetTextPosition( pos );
SetPos0( GetTextPosition() );
SetOrientation( GetOrientation() + aAngle );
}
void TEXTE_MODULE::Copy( TEXTE_MODULE* source ) void TEXTE_MODULE::Copy( TEXTE_MODULE* source )
{ {
if( source == NULL ) if( source == NULL )
...@@ -218,24 +248,31 @@ void TEXTE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, ...@@ -218,24 +248,31 @@ void TEXTE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode,
return; return;
BOARD* brd = GetBoard( ); BOARD* brd = GetBoard( );
EDA_COLOR_T color;
// Determine the element color or suppress it element if hidden
switch( module->GetLayer() )
{
case B_Cu:
if( !brd->IsElementVisible( MOD_TEXT_BK_VISIBLE ) )
return;
color = brd->GetVisibleElementColor( MOD_TEXT_BK_VISIBLE );
break;
case F_Cu: // Suppress the element if the layer it is on is on a disabled side
if( !brd->IsElementVisible( MOD_TEXT_FR_VISIBLE ) ) LAYER_ID text_layer = GetLayer();
if( (IsFrontLayer( text_layer ) && !brd->IsElementVisible( MOD_TEXT_FR_VISIBLE )) ||
(IsBackLayer( text_layer ) && !brd->IsElementVisible( MOD_TEXT_BK_VISIBLE )) )
return; return;
/* Reference and values takes the color from the corresponding Visibles
other texts take the color of the layer they are on */
EDA_COLOR_T color;
switch( GetType() )
{
case TEXT_is_REFERENCE:
case TEXT_is_VALUE:
if( IsFrontLayer( text_layer ) )
color = brd->GetVisibleElementColor( MOD_TEXT_FR_VISIBLE ); color = brd->GetVisibleElementColor( MOD_TEXT_FR_VISIBLE );
else
color = brd->GetVisibleElementColor( MOD_TEXT_BK_VISIBLE );
break; break;
default: case TEXT_is_DIVERS:
color = brd->GetLayerColor( module->GetLayer() ); default: // This is to persuade the compiler that color is always initialized
color = brd->GetLayerColor( GetLayer() );
} }
// 'Ghost' the element if forced show // 'Ghost' the element if forced show
...@@ -247,7 +284,7 @@ void TEXTE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, ...@@ -247,7 +284,7 @@ void TEXTE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode,
} }
// Draw mode compensation for the width // Draw mode compensation for the width
PCB_BASE_FRAME* frame = (PCB_BASE_FRAME*) panel->GetParent(); PCB_BASE_FRAME* frame = static_cast<PCB_BASE_FRAME*>( panel->GetParent() );
int width = m_Thickness; int width = m_Thickness;
if( ( frame->m_DisplayModText == LINE ) if( ( frame->m_DisplayModText == LINE )
|| ( DC->LogicalToDeviceXRel( width ) <= MIN_DRAW_WIDTH ) ) || ( DC->LogicalToDeviceXRel( width ) <= MIN_DRAW_WIDTH ) )
...@@ -295,7 +332,7 @@ void TEXTE_MODULE::DrawUmbilical( EDA_DRAW_PANEL* aPanel, ...@@ -295,7 +332,7 @@ void TEXTE_MODULE::DrawUmbilical( EDA_DRAW_PANEL* aPanel,
GR_DRAWMODE aDrawMode, GR_DRAWMODE aDrawMode,
const wxPoint& aOffset ) const wxPoint& aOffset )
{ {
MODULE* parent = (MODULE*) GetParent(); MODULE* parent = static_cast<MODULE*>( GetParent() );
if( !parent ) if( !parent )
return; return;
...@@ -384,22 +421,21 @@ void TEXTE_MODULE::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) ...@@ -384,22 +421,21 @@ void TEXTE_MODULE::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
wxString TEXTE_MODULE::GetSelectMenuText() const wxString TEXTE_MODULE::GetSelectMenuText() const
{ {
wxString text; wxString text;
const wxChar *reference = GetChars( static_cast<MODULE*>( GetParent() )->GetReference() );
switch( m_Type ) switch( m_Type )
{ {
case TEXT_is_REFERENCE: case TEXT_is_REFERENCE:
text.Printf( _( "Reference %s" ), GetChars( m_Text ) ); text.Printf( _( "Reference %s" ), reference );
break; break;
case TEXT_is_VALUE: case TEXT_is_VALUE:
text.Printf( _( "Value %s of %s" ), GetChars( m_Text ), text.Printf( _( "Value %s of %s" ), GetChars( m_Text ), reference );
GetChars( ( (MODULE*) GetParent() )->GetReference() ) );
break; break;
default: // wrap this one in quotes: default: // wrap this one in quotes:
text.Printf( _( "Text \"%s\" on %s of %s" ), GetChars( m_Text ), text.Printf( _( "Text \"%s\" on %s of %s" ), GetChars( m_Text ),
GetChars( GetLayerName() ), GetChars( GetLayerName() ), reference );
GetChars( ( (MODULE*) GetParent() )->GetReference() ) );
break; break;
} }
...@@ -443,23 +479,11 @@ void TEXTE_MODULE::ViewGetLayers( int aLayers[], int& aCount ) const ...@@ -443,23 +479,11 @@ void TEXTE_MODULE::ViewGetLayers( int aLayers[], int& aCount ) const
aLayers[0] = ITEM_GAL_LAYER( MOD_VALUES_VISIBLE ); aLayers[0] = ITEM_GAL_LAYER( MOD_VALUES_VISIBLE );
break; break;
default: case TEXT_is_DIVERS:
switch( GetParent()->GetLayer() ) aLayers[0] = GetLayer();
{
case B_Cu:
aLayers[0] = ITEM_GAL_LAYER( MOD_TEXT_BK_VISIBLE ); // how about B_SilkS?
break;
case F_Cu:
aLayers[0] = ITEM_GAL_LAYER( MOD_TEXT_FR_VISIBLE ); // how about F_SilkS?
break;
default:
wxFAIL_MSG( wxT( "Can't tell text layer" ) );
}
break;
} }
} }
aCount = 1; aCount = 1;
} }
...@@ -48,11 +48,13 @@ class MSG_PANEL_ITEM; ...@@ -48,11 +48,13 @@ class MSG_PANEL_ITEM;
class TEXTE_MODULE : public BOARD_ITEM, public EDA_TEXT class TEXTE_MODULE : public BOARD_ITEM, public EDA_TEXT
{ {
// @todo eliminate these friends, make them use accessors
friend class MODULE;
friend class FOOTPRINT_EDIT_FRAME;
public: public:
/** Text module type: there must be only one (and only one) for each
* of the reference and value texts in one module; others could be
* added for the user (DIVERS is French for 'others'). Reference and
* value always live on silkscreen (on the module side); other texts
* are planned to go on whatever layer the user wants (except
* copper, probably) */
enum TEXT_TYPE enum TEXT_TYPE
{ {
TEXT_is_REFERENCE = 0, TEXT_is_REFERENCE = 0,
...@@ -92,6 +94,15 @@ public: ...@@ -92,6 +94,15 @@ public:
void Flip( const wxPoint& aCentre ); void Flip( const wxPoint& aCentre );
/// Rotate entity during module rotation
void RotateWithModule( const wxPoint& aOffset, double aAngle );
/// Flip entity during module flip
void FlipWithModule( int aOffset );
/// Mirror entiry during module mirroring
void MirrorWithModule( int aOffset );
/// @deprecated it seems (but the type is used to 'protect' /// @deprecated it seems (but the type is used to 'protect'
//reference and value from deletion, and for identification) //reference and value from deletion, and for identification)
void SetType( TEXT_TYPE aType ) { m_Type = aType; } void SetType( TEXT_TYPE aType ) { m_Type = aType; }
...@@ -100,6 +111,7 @@ public: ...@@ -100,6 +111,7 @@ public:
void SetVisible( bool isVisible ) { m_NoShow = !isVisible; } void SetVisible( bool isVisible ) { m_NoShow = !isVisible; }
bool IsVisible() const { return !m_NoShow; } bool IsVisible() const { return !m_NoShow; }
// The Pos0 accessors are for module-relative coordinates
void SetPos0( const wxPoint& aPos ) { m_Pos0 = aPos; SetDrawCoord(); } void SetPos0( const wxPoint& aPos ) { m_Pos0 = aPos; SetDrawCoord(); }
const wxPoint& GetPos0() const { return m_Pos0; } const wxPoint& GetPos0() const { return m_Pos0; }
......
...@@ -286,9 +286,10 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, const void* testDa ...@@ -286,9 +286,10 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, const void* testDa
break; break;
case PCB_MODULE_TEXT_T: case PCB_MODULE_TEXT_T:
module = (MODULE*) item->GetParent(); module = static_cast<MODULE*>( item->GetParent() );
if( m_Guide->IgnoreMTextsMarkedNoShow() && !( (TEXTE_MODULE*) item )->IsVisible() ) if( m_Guide->IgnoreMTextsMarkedNoShow() &&
!static_cast<TEXTE_MODULE*>( item )->IsVisible() )
goto exit; goto exit;
if( module ) if( module )
......
...@@ -154,12 +154,14 @@ std::string FormatProbeItem( BOARD_ITEM* aItem ) ...@@ -154,12 +154,14 @@ std::string FormatProbeItem( BOARD_ITEM* aItem )
case PCB_MODULE_TEXT_T: case PCB_MODULE_TEXT_T:
{ {
module = (MODULE*) aItem->GetParent(); module = static_cast<MODULE*>( aItem->GetParent() );
TEXTE_MODULE* text_mod = (TEXTE_MODULE*) aItem; TEXTE_MODULE* text_mod = static_cast<TEXTE_MODULE*>( aItem );
const char* text_key; const char* text_key;
/* This can't be a switch since the break need to pull out
* from the outer switch! */
if( text_mod->GetType() == TEXTE_MODULE::TEXT_is_REFERENCE ) if( text_mod->GetType() == TEXTE_MODULE::TEXT_is_REFERENCE )
text_key = "$REF:"; text_key = "$REF:";
else if( text_mod->GetType() == TEXTE_MODULE::TEXT_is_VALUE ) else if( text_mod->GetType() == TEXTE_MODULE::TEXT_is_VALUE )
......
...@@ -123,7 +123,7 @@ void DialogEditModuleText::initDlg( ) ...@@ -123,7 +123,7 @@ void DialogEditModuleText::initDlg( )
m_TextDataTitle->SetLabel( _( "Text:" ) ); m_TextDataTitle->SetLabel( _( "Text:" ) );
break; break;
default: case TEXTE_MODULE::TEXT_is_REFERENCE:
m_TextDataTitle->SetLabel( _( "Reference:" ) ); m_TextDataTitle->SetLabel( _( "Reference:" ) );
break; break;
} }
......
...@@ -145,7 +145,6 @@ void PCB_BASE_FRAME::ResetModuleTextSizes( const wxString & aFilter, bool aRef, ...@@ -145,7 +145,6 @@ void PCB_BASE_FRAME::ResetModuleTextSizes( const wxString & aFilter, bool aRef,
{ {
MODULE* module; MODULE* module;
BOARD_ITEM* boardItem; BOARD_ITEM* boardItem;
TEXTE_MODULE* item;
ITEM_PICKER itemWrapper( NULL, UR_CHANGED ); ITEM_PICKER itemWrapper( NULL, UR_CHANGED );
PICKED_ITEMS_LIST undoItemList; PICKED_ITEMS_LIST undoItemList;
unsigned int ii; unsigned int ii;
...@@ -165,7 +164,7 @@ void PCB_BASE_FRAME::ResetModuleTextSizes( const wxString & aFilter, bool aRef, ...@@ -165,7 +164,7 @@ void PCB_BASE_FRAME::ResetModuleTextSizes( const wxString & aFilter, bool aRef,
if( aRef ) if( aRef )
{ {
item = &module->Reference(); TEXTE_MODULE *item = &module->Reference();
if( item->GetSize() != GetDesignSettings().m_ModuleTextSize || if( item->GetSize() != GetDesignSettings().m_ModuleTextSize ||
item->GetThickness() != GetDesignSettings().m_ModuleTextWidth ) item->GetThickness() != GetDesignSettings().m_ModuleTextWidth )
...@@ -176,7 +175,7 @@ void PCB_BASE_FRAME::ResetModuleTextSizes( const wxString & aFilter, bool aRef, ...@@ -176,7 +175,7 @@ void PCB_BASE_FRAME::ResetModuleTextSizes( const wxString & aFilter, bool aRef,
if( aValue ) if( aValue )
{ {
item = &module->Value(); TEXTE_MODULE *item = &module->Value();
if( item->GetSize() != GetDesignSettings().m_ModuleTextSize || if( item->GetSize() != GetDesignSettings().m_ModuleTextSize ||
item->GetThickness() != GetDesignSettings().m_ModuleTextWidth ) item->GetThickness() != GetDesignSettings().m_ModuleTextWidth )
...@@ -192,7 +191,7 @@ void PCB_BASE_FRAME::ResetModuleTextSizes( const wxString & aFilter, bool aRef, ...@@ -192,7 +191,7 @@ void PCB_BASE_FRAME::ResetModuleTextSizes( const wxString & aFilter, bool aRef,
{ {
if( boardItem->Type() == PCB_MODULE_TEXT_T ) if( boardItem->Type() == PCB_MODULE_TEXT_T )
{ {
item = (TEXTE_MODULE*) boardItem; TEXTE_MODULE *item = static_cast<TEXTE_MODULE*>( boardItem );
if( item->GetSize() != GetDesignSettings().m_ModuleTextSize if( item->GetSize() != GetDesignSettings().m_ModuleTextSize
|| item->GetThickness() != GetDesignSettings().m_ModuleTextWidth ) || item->GetThickness() != GetDesignSettings().m_ModuleTextWidth )
...@@ -233,7 +232,7 @@ void PCB_BASE_FRAME::ResetModuleTextSizes( const wxString & aFilter, bool aRef, ...@@ -233,7 +232,7 @@ void PCB_BASE_FRAME::ResetModuleTextSizes( const wxString & aFilter, bool aRef,
{ {
if( boardItem->Type() == PCB_MODULE_TEXT_T ) if( boardItem->Type() == PCB_MODULE_TEXT_T )
{ {
item = (TEXTE_MODULE*) boardItem; TEXTE_MODULE *item = static_cast<TEXTE_MODULE*>( boardItem );
item->SetThickness( GetDesignSettings().m_ModuleTextWidth ); item->SetThickness( GetDesignSettings().m_ModuleTextWidth );
item->SetSize( GetDesignSettings().m_ModuleTextSize ); item->SetSize( GetDesignSettings().m_ModuleTextSize );
} }
......
...@@ -770,12 +770,12 @@ bool DIALOG_PAD_PROPERTIES::padValuesOK() ...@@ -770,12 +770,12 @@ bool DIALOG_PAD_PROPERTIES::padValuesOK()
error_msgs.Add( _( "Error: Connector pads are not on the solder paste layer\n" error_msgs.Add( _( "Error: Connector pads are not on the solder paste layer\n"
"Use SMD pads instead" ) ); "Use SMD pads instead" ) );
// Fall trough // Fall trough
/*
case PAD_SMD: // SMD and Connector pads (One external copper layer only) case PAD_SMD: // SMD and Connector pads (One external copper layer only)
/*
if( padlayers_mask[B_Cu] && padlayers_mask[F_Cu] ) if( padlayers_mask[B_Cu] && padlayers_mask[F_Cu] )
error_msgs.Add( _( "Error: only one copper layer allowed for SMD or Connector pads" ) ); error_msgs.Add( _( "Error: only one copper layer allowed for SMD or Connector pads" ) );
break;
*/ */
break;
} }
if( error_msgs.GetCount() ) if( error_msgs.GetCount() )
......
...@@ -932,7 +932,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -932,7 +932,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_POPUP_PCB_EDIT_TEXTMODULE: case ID_POPUP_PCB_EDIT_TEXTMODULE:
InstallTextModOptionsFrame( (TEXTE_MODULE*) GetCurItem(), &dc ); InstallTextModOptionsFrame( static_cast<TEXTE_MODULE*>( GetCurItem() ), &dc );
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
break; break;
...@@ -942,17 +942,16 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -942,17 +942,16 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_MOVE_TEXTMODULE_REQUEST: case ID_POPUP_PCB_MOVE_TEXTMODULE_REQUEST:
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
StartMoveTexteModule( (TEXTE_MODULE*) GetCurItem(), &dc ); StartMoveTexteModule( static_cast<TEXTE_MODULE*>( GetCurItem() ), &dc );
break; break;
case ID_POPUP_PCB_ROTATE_TEXTMODULE: case ID_POPUP_PCB_ROTATE_TEXTMODULE:
RotateTextModule( (TEXTE_MODULE*) GetCurItem(), RotateTextModule( static_cast<TEXTE_MODULE*>( GetCurItem() ), &dc );
&dc );
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
break; break;
case ID_POPUP_PCB_DELETE_TEXTMODULE: case ID_POPUP_PCB_DELETE_TEXTMODULE:
DeleteTextModule( (TEXTE_MODULE*) GetCurItem() ); DeleteTextModule( static_cast<TEXTE_MODULE*>( GetCurItem() ) );
SetCurItem( NULL ); SetCurItem( NULL );
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
break; break;
......
...@@ -99,7 +99,7 @@ void FOOTPRINT_EDIT_FRAME::RemoveStruct( EDA_ITEM* Item ) ...@@ -99,7 +99,7 @@ void FOOTPRINT_EDIT_FRAME::RemoveStruct( EDA_ITEM* Item )
case PCB_MODULE_TEXT_T: case PCB_MODULE_TEXT_T:
{ {
TEXTE_MODULE* text = (TEXTE_MODULE*) Item; TEXTE_MODULE* text = static_cast<TEXTE_MODULE*>( Item );
switch( text->GetType() ) switch( text->GetType() )
{ {
...@@ -111,7 +111,7 @@ void FOOTPRINT_EDIT_FRAME::RemoveStruct( EDA_ITEM* Item ) ...@@ -111,7 +111,7 @@ void FOOTPRINT_EDIT_FRAME::RemoveStruct( EDA_ITEM* Item )
DisplayError( this, _( "Cannot delete VALUE!" ) ); DisplayError( this, _( "Cannot delete VALUE!" ) );
break; break;
default: case TEXTE_MODULE::TEXT_is_DIVERS:
DeleteTextModule( text ); DeleteTextModule( text );
} }
} }
......
...@@ -263,11 +263,11 @@ void PCB_EDIT_FRAME::Show_1_Ratsnest( EDA_ITEM* item, wxDC* DC ) ...@@ -263,11 +263,11 @@ void PCB_EDIT_FRAME::Show_1_Ratsnest( EDA_ITEM* item, wxDC* DC )
if( item->Type() == PCB_MODULE_TEXT_T ) if( item->Type() == PCB_MODULE_TEXT_T )
{ {
if( item->GetParent() && ( item->GetParent()->Type() == PCB_MODULE_T ) ) if( item->GetParent() && ( item->GetParent()->Type() == PCB_MODULE_T ) )
Module = (MODULE*) item->GetParent(); Module = static_cast<MODULE*>( item->GetParent() );
} }
else if( item->Type() == PCB_MODULE_T ) else if( item->Type() == PCB_MODULE_T )
{ {
Module = (MODULE*) item; Module = static_cast<MODULE*>( item );
} }
if( Module ) if( Module )
......
...@@ -59,14 +59,12 @@ static double TextInitialOrientation; // module text initial orientation for ...@@ -59,14 +59,12 @@ static double TextInitialOrientation; // module text initial orientation for
/* Add a new graphical text to the active module (footprint) /* Add a new graphical text to the active module (footprint)
* Note there always are 2 texts: reference and value. * Note there always are 2 mandatory texts: reference and value.
* New texts have the member TEXTE_MODULE.GetType() set to TEXT_is_DIVERS * New texts have the member TEXTE_MODULE.GetType() set to TEXT_is_DIVERS
*/ */
TEXTE_MODULE* PCB_BASE_FRAME::CreateTextModule( MODULE* Module, wxDC* DC ) TEXTE_MODULE* PCB_BASE_FRAME::CreateTextModule( MODULE* Module, wxDC* DC )
{ {
TEXTE_MODULE* Text; TEXTE_MODULE* Text = new TEXTE_MODULE( Module );
Text = new TEXTE_MODULE( Module );
// Add the new text object to the beginning of the draw item list. // Add the new text object to the beginning of the draw item list.
if( Module ) if( Module )
...@@ -137,7 +135,7 @@ void PCB_BASE_FRAME::DeleteTextModule( TEXTE_MODULE* Text ) ...@@ -137,7 +135,7 @@ void PCB_BASE_FRAME::DeleteTextModule( TEXTE_MODULE* Text )
if( Text == NULL ) if( Text == NULL )
return; return;
Module = (MODULE*) Text->GetParent(); Module = static_cast<MODULE*>( Text->GetParent() );
if( Text->GetType() == TEXTE_MODULE::TEXT_is_DIVERS ) if( Text->GetType() == TEXTE_MODULE::TEXT_is_DIVERS )
{ {
...@@ -157,7 +155,7 @@ void PCB_BASE_FRAME::DeleteTextModule( TEXTE_MODULE* Text ) ...@@ -157,7 +155,7 @@ void PCB_BASE_FRAME::DeleteTextModule( TEXTE_MODULE* Text )
static void AbortMoveTextModule( EDA_DRAW_PANEL* Panel, wxDC* DC ) static void AbortMoveTextModule( EDA_DRAW_PANEL* Panel, wxDC* DC )
{ {
BASE_SCREEN* screen = Panel->GetScreen(); BASE_SCREEN* screen = Panel->GetScreen();
TEXTE_MODULE* Text = (TEXTE_MODULE*) screen->GetCurItem(); TEXTE_MODULE* Text = static_cast<TEXTE_MODULE*>( screen->GetCurItem() );
MODULE* Module; MODULE* Module;
Panel->SetMouseCapture( NULL, NULL ); Panel->SetMouseCapture( NULL, NULL );
...@@ -165,7 +163,7 @@ static void AbortMoveTextModule( EDA_DRAW_PANEL* Panel, wxDC* DC ) ...@@ -165,7 +163,7 @@ static void AbortMoveTextModule( EDA_DRAW_PANEL* Panel, wxDC* DC )
if( Text == NULL ) if( Text == NULL )
return; return;
Module = (MODULE*) Text->GetParent(); Module = static_cast<MODULE*>( Text->GetParent() );
Text->DrawUmbilical( Panel, DC, GR_XOR, -MoveVector ); Text->DrawUmbilical( Panel, DC, GR_XOR, -MoveVector );
Text->Draw( Panel, DC, GR_XOR, MoveVector ); Text->Draw( Panel, DC, GR_XOR, MoveVector );
...@@ -192,12 +190,10 @@ static void AbortMoveTextModule( EDA_DRAW_PANEL* Panel, wxDC* DC ) ...@@ -192,12 +190,10 @@ static void AbortMoveTextModule( EDA_DRAW_PANEL* Panel, wxDC* DC )
*/ */
void PCB_BASE_FRAME::StartMoveTexteModule( TEXTE_MODULE* Text, wxDC* DC ) void PCB_BASE_FRAME::StartMoveTexteModule( TEXTE_MODULE* Text, wxDC* DC )
{ {
MODULE* Module;
if( Text == NULL ) if( Text == NULL )
return; return;
Module = (MODULE*) Text->GetParent(); MODULE *Module = static_cast<MODULE*>( Text->GetParent() );
Text->SetFlags( IS_MOVED ); Text->SetFlags( IS_MOVED );
Module->SetFlags( IN_EDIT ); Module->SetFlags( IN_EDIT );
...@@ -228,7 +224,7 @@ void PCB_BASE_FRAME::PlaceTexteModule( TEXTE_MODULE* Text, wxDC* DC ) ...@@ -228,7 +224,7 @@ void PCB_BASE_FRAME::PlaceTexteModule( TEXTE_MODULE* Text, wxDC* DC )
Text->DrawUmbilical( m_canvas, DC, GR_XOR, -MoveVector ); Text->DrawUmbilical( m_canvas, DC, GR_XOR, -MoveVector );
// Update the coordinates for anchor. // Update the coordinates for anchor.
MODULE* Module = (MODULE*) Text->GetParent(); MODULE* Module = static_cast<MODULE*>( Text->GetParent() );
if( Module ) if( Module )
{ {
...@@ -273,7 +269,7 @@ static void Show_MoveTexte_Module( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo ...@@ -273,7 +269,7 @@ static void Show_MoveTexte_Module( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo
bool aErase ) bool aErase )
{ {
BASE_SCREEN* screen = aPanel->GetScreen(); BASE_SCREEN* screen = aPanel->GetScreen();
TEXTE_MODULE* Text = (TEXTE_MODULE*) screen->GetCurItem(); TEXTE_MODULE* Text = static_cast<TEXTE_MODULE*>( screen->GetCurItem() );
if( Text == NULL ) if( Text == NULL )
return; return;
...@@ -308,21 +304,20 @@ void PCB_BASE_FRAME::ResetTextSize( BOARD_ITEM* aItem, wxDC* aDC ) ...@@ -308,21 +304,20 @@ void PCB_BASE_FRAME::ResetTextSize( BOARD_ITEM* aItem, wxDC* aDC )
case PCB_TEXT_T: case PCB_TEXT_T:
newSize = GetDesignSettings().m_PcbTextSize; newSize = GetDesignSettings().m_PcbTextSize;
newThickness = GetDesignSettings().m_PcbTextWidth; newThickness = GetDesignSettings().m_PcbTextWidth;
pcbText = (TEXTE_PCB*) aItem; pcbText = static_cast<TEXTE_PCB*>( aItem );
text = (EDA_TEXT*) pcbText; text = static_cast<EDA_TEXT*>( pcbText );
break; break;
case PCB_MODULE_TEXT_T: case PCB_MODULE_TEXT_T:
newSize = GetDesignSettings().m_ModuleTextSize; newSize = GetDesignSettings().m_ModuleTextSize;
newThickness = GetDesignSettings().m_ModuleTextWidth; newThickness = GetDesignSettings().m_ModuleTextWidth;
moduleText = (TEXTE_MODULE*) aItem; moduleText = static_cast<TEXTE_MODULE*>( aItem );
text = (EDA_TEXT*) moduleText; text = static_cast<EDA_TEXT*>( moduleText );
break; break;
default: default:
// Exit if aItem is not a text field // Exit if aItem is not a text field
return; return;
break;
} }
// Exit if there's nothing to do // Exit if there's nothing to do
......
...@@ -697,7 +697,6 @@ static void CreateComponentsSection( FILE* aFile, BOARD* aPcb ) ...@@ -697,7 +697,6 @@ static void CreateComponentsSection( FILE* aFile, BOARD* aPcb )
for( MODULE* module = aPcb->m_Modules; module; module = module->Next() ) for( MODULE* module = aPcb->m_Modules; module; module = module->Next() )
{ {
TEXTE_MODULE* textmod;
const char* mirror; const char* mirror;
const char* flip; const char* flip;
double orient = module->GetOrientation(); double orient = module->GetOrientation();
...@@ -731,7 +730,7 @@ static void CreateComponentsSection( FILE* aFile, BOARD* aPcb ) ...@@ -731,7 +730,7 @@ static void CreateComponentsSection( FILE* aFile, BOARD* aPcb )
mirror, flip ); mirror, flip );
// Text on silk layer: RefDes and value (are they actually useful?) // Text on silk layer: RefDes and value (are they actually useful?)
textmod = &module->Reference(); TEXTE_MODULE *textmod = &module->Reference();
for( int ii = 0; ii < 2; ii++ ) for( int ii = 0; ii < 2; ii++ )
{ {
......
...@@ -1211,11 +1211,11 @@ static void export_vrml_module( MODEL_VRML& aModel, BOARD* aPcb, MODULE* aModule ...@@ -1211,11 +1211,11 @@ static void export_vrml_module( MODEL_VRML& aModel, BOARD* aPcb, MODULE* aModule
switch( item->Type() ) switch( item->Type() )
{ {
case PCB_MODULE_TEXT_T: case PCB_MODULE_TEXT_T:
export_vrml_text_module( dynamic_cast<TEXTE_MODULE*>( item ) ); export_vrml_text_module( static_cast<TEXTE_MODULE*>( item ) );
break; break;
case PCB_MODULE_EDGE_T: case PCB_MODULE_EDGE_T:
export_vrml_edge_module( aModel, dynamic_cast<EDGE_MODULE*>( item ), export_vrml_edge_module( aModel, static_cast<EDGE_MODULE*>( item ),
aModule->GetOrientation() ); aModule->GetOrientation() );
break; break;
......
...@@ -34,6 +34,9 @@ ...@@ -34,6 +34,9 @@
#include <class_board.h> #include <class_board.h>
#include <class_module.h> #include <class_module.h>
#include <class_track.h> #include <class_track.h>
#include <class_pcb_text.h>
#include <class_mire.h>
#include <class_drawsegment.h>
#include <pcbnew.h> #include <pcbnew.h>
#include <pcbnew_id.h> #include <pcbnew_id.h>
...@@ -900,33 +903,33 @@ bool PCB_EDIT_FRAME::OnHotkeyPlaceItem( wxDC* aDC ) ...@@ -900,33 +903,33 @@ bool PCB_EDIT_FRAME::OnHotkeyPlaceItem( wxDC* aDC )
case PCB_TRACE_T: case PCB_TRACE_T:
case PCB_VIA_T: case PCB_VIA_T:
if( item->IsDragging() ) if( item->IsDragging() )
PlaceDraggedOrMovedTrackSegment( (TRACK*) item, aDC ); PlaceDraggedOrMovedTrackSegment( static_cast<TRACK*>( item ), aDC );
break; break;
case PCB_TEXT_T: case PCB_TEXT_T:
Place_Texte_Pcb( (TEXTE_PCB*) item, aDC ); Place_Texte_Pcb( static_cast<TEXTE_PCB*>( item ), aDC );
break; break;
case PCB_MODULE_TEXT_T: case PCB_MODULE_TEXT_T:
PlaceTexteModule( (TEXTE_MODULE*) item, aDC ); PlaceTexteModule( static_cast<TEXTE_MODULE*>( item ), aDC );
break; break;
case PCB_PAD_T: case PCB_PAD_T:
PlacePad( (D_PAD*) item, aDC ); PlacePad( static_cast<D_PAD*>( item ), aDC );
break; break;
case PCB_MODULE_T: case PCB_MODULE_T:
PlaceModule( (MODULE*) item, aDC ); PlaceModule( static_cast<MODULE*>( item ), aDC );
break; break;
case PCB_TARGET_T: case PCB_TARGET_T:
PlaceTarget( (PCB_TARGET*) item, aDC ); PlaceTarget( static_cast<PCB_TARGET*>( item ), aDC );
break; break;
case PCB_LINE_T: case PCB_LINE_T:
if( no_tool ) // when no tools: existing item moving. if( no_tool ) // when no tools: existing item moving.
Place_DrawItem( (DRAWSEGMENT*) item, aDC ); Place_DrawItem( static_cast<DRAWSEGMENT*>( item ), aDC );
break; break;
......
...@@ -430,48 +430,48 @@ void PCB_IO::Format( BOARD_ITEM* aItem, int aNestLevel ) const ...@@ -430,48 +430,48 @@ void PCB_IO::Format( BOARD_ITEM* aItem, int aNestLevel ) const
switch( aItem->Type() ) switch( aItem->Type() )
{ {
case PCB_T: case PCB_T:
format( (BOARD*) aItem, aNestLevel ); format( static_cast<BOARD*>( aItem ), aNestLevel );
break; break;
case PCB_DIMENSION_T: case PCB_DIMENSION_T:
format( ( DIMENSION*) aItem, aNestLevel ); format( static_cast<DIMENSION*>( aItem ), aNestLevel );
break; break;
case PCB_LINE_T: case PCB_LINE_T:
format( (DRAWSEGMENT*) aItem, aNestLevel ); format( static_cast<DRAWSEGMENT*>( aItem ), aNestLevel );
break; break;
case PCB_MODULE_EDGE_T: case PCB_MODULE_EDGE_T:
format( (EDGE_MODULE*) aItem, aNestLevel ); format( static_cast<EDGE_MODULE*>( aItem ), aNestLevel );
break; break;
case PCB_TARGET_T: case PCB_TARGET_T:
format( (PCB_TARGET*) aItem, aNestLevel ); format( static_cast<PCB_TARGET*>( aItem ), aNestLevel );
break; break;
case PCB_MODULE_T: case PCB_MODULE_T:
format( (MODULE*) aItem, aNestLevel ); format( static_cast<MODULE*>( aItem ), aNestLevel );
break; break;
case PCB_PAD_T: case PCB_PAD_T:
format( (D_PAD*) aItem, aNestLevel ); format( static_cast<D_PAD*>( aItem ), aNestLevel );
break; break;
case PCB_TEXT_T: case PCB_TEXT_T:
format( (TEXTE_PCB*) aItem, aNestLevel ); format( static_cast<TEXTE_PCB*>( aItem ), aNestLevel );
break; break;
case PCB_MODULE_TEXT_T: case PCB_MODULE_TEXT_T:
format( (TEXTE_MODULE*) aItem, aNestLevel ); format( static_cast<TEXTE_MODULE*>( aItem ), aNestLevel );
break; break;
case PCB_TRACE_T: case PCB_TRACE_T:
case PCB_VIA_T: case PCB_VIA_T:
format( (TRACK*) aItem, aNestLevel ); format( static_cast<TRACK*>( aItem ), aNestLevel );
break; break;
case PCB_ZONE_AREA_T: case PCB_ZONE_AREA_T:
format( (ZONE_CONTAINER*) aItem, aNestLevel ); format( static_cast<ZONE_CONTAINER*>( aItem ), aNestLevel );
break; break;
default: default:
...@@ -599,7 +599,7 @@ void PCB_IO::format( BOARD* aBoard, int aNestLevel ) const ...@@ -599,7 +599,7 @@ void PCB_IO::format( BOARD* aBoard, int aNestLevel ) const
B_CrtYd, B_CrtYd,
F_CrtYd, F_CrtYd,
B_Fab, B_Fab,
F_Fab, F_Fab
}; };
for( LSEQ seq = aBoard->GetEnabledLayers().Seq( non_cu, DIM( non_cu ) ); seq; ++seq ) for( LSEQ seq = aBoard->GetEnabledLayers().Seq( non_cu, DIM( non_cu ) ); seq; ++seq )
...@@ -1403,7 +1403,7 @@ void PCB_IO::format( TEXTE_MODULE* aText, int aNestLevel ) const ...@@ -1403,7 +1403,7 @@ void PCB_IO::format( TEXTE_MODULE* aText, int aNestLevel ) const
{ {
case TEXTE_MODULE::TEXT_is_REFERENCE: type = wxT( "reference" ); break; case TEXTE_MODULE::TEXT_is_REFERENCE: type = wxT( "reference" ); break;
case TEXTE_MODULE::TEXT_is_VALUE: type = wxT( "value" ); break; case TEXTE_MODULE::TEXT_is_VALUE: type = wxT( "value" ); break;
default: type = wxT( "user" ); case TEXTE_MODULE::TEXT_is_DIVERS: type = wxT( "user" );
} }
// Due to the Pcbnew history, m_Orient is saved in screen value // Due to the Pcbnew history, m_Orient is saved in screen value
......
...@@ -1221,7 +1221,7 @@ void LEGACY_PLUGIN::loadMODULE( MODULE* aModule ) ...@@ -1221,7 +1221,7 @@ void LEGACY_PLUGIN::loadMODULE( MODULE* aModule )
int tnum = intParse( line + SZ( "T" ) ); int tnum = intParse( line + SZ( "T" ) );
TEXTE_MODULE* textm; TEXTE_MODULE* textm = 0;
switch( tnum ) switch( tnum )
{ {
...@@ -1233,7 +1233,7 @@ void LEGACY_PLUGIN::loadMODULE( MODULE* aModule ) ...@@ -1233,7 +1233,7 @@ void LEGACY_PLUGIN::loadMODULE( MODULE* aModule )
textm = &aModule->Value(); textm = &aModule->Value();
break; break;
default: case TEXTE_MODULE::TEXT_is_DIVERS:
// text is a drawing // text is a drawing
textm = new TEXTE_MODULE( aModule ); textm = new TEXTE_MODULE( aModule );
aModule->GraphicalItems().PushBack( textm ); aModule->GraphicalItems().PushBack( textm );
...@@ -1868,7 +1868,7 @@ void LEGACY_PLUGIN::loadMODULE_TEXT( TEXTE_MODULE* aText ) ...@@ -1868,7 +1868,7 @@ void LEGACY_PLUGIN::loadMODULE_TEXT( TEXTE_MODULE* aText )
aText->SetPos0( wxPoint( pos0_x, pos0_y ) ); aText->SetPos0( wxPoint( pos0_x, pos0_y ) );
aText->SetSize( wxSize( size0_x, size0_y ) ); aText->SetSize( wxSize( size0_x, size0_y ) );
orient -= ( (MODULE*) aText->GetParent() )->GetOrientation(); orient -= ( static_cast<MODULE*>( aText->GetParent() ) )->GetOrientation();
aText->SetOrientation( orient ); aText->SetOrientation( orient );
...@@ -3832,10 +3832,10 @@ void LEGACY_PLUGIN::saveMODULE( const MODULE* me ) const ...@@ -3832,10 +3832,10 @@ void LEGACY_PLUGIN::saveMODULE( const MODULE* me ) const
switch( gr->Type() ) switch( gr->Type() )
{ {
case PCB_MODULE_TEXT_T: case PCB_MODULE_TEXT_T:
saveMODULE_TEXT( (TEXTE_MODULE*) gr ); saveMODULE_TEXT( static_cast<TEXTE_MODULE*>( gr ));
break; break;
case PCB_MODULE_EDGE_T: case PCB_MODULE_EDGE_T:
saveMODULE_EDGE( (EDGE_MODULE*) gr ); saveMODULE_EDGE( static_cast<EDGE_MODULE*>( gr ));
break; break;
default: default:
THROW_IO_ERROR( wxString::Format( UNKNOWN_GRAPHIC_FORMAT, gr->Type() ) ); THROW_IO_ERROR( wxString::Format( UNKNOWN_GRAPHIC_FORMAT, gr->Type() ) );
......
...@@ -656,29 +656,29 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -656,29 +656,29 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_POPUP_PCB_EDIT_TEXTMODULE: case ID_POPUP_PCB_EDIT_TEXTMODULE:
InstallTextModOptionsFrame( (TEXTE_MODULE*) GetScreen()->GetCurItem(), &dc ); InstallTextModOptionsFrame( static_cast<TEXTE_MODULE*>( GetScreen()->GetCurItem() ), &dc );
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
break; break;
case ID_POPUP_PCB_MOVE_TEXTMODULE_REQUEST: case ID_POPUP_PCB_MOVE_TEXTMODULE_REQUEST:
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
StartMoveTexteModule( (TEXTE_MODULE*) GetScreen()->GetCurItem(), &dc ); StartMoveTexteModule( static_cast<TEXTE_MODULE*>( GetScreen()->GetCurItem() ), &dc );
break; break;
case ID_POPUP_PCB_ROTATE_TEXTMODULE: case ID_POPUP_PCB_ROTATE_TEXTMODULE:
RotateTextModule( (TEXTE_MODULE*) GetScreen()->GetCurItem(), &dc ); RotateTextModule( static_cast<TEXTE_MODULE*>( GetScreen()->GetCurItem() ), &dc );
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
break; break;
case ID_POPUP_PCB_DELETE_TEXTMODULE: case ID_POPUP_PCB_DELETE_TEXTMODULE:
SaveCopyInUndoList( GetBoard()->m_Modules, UR_MODEDIT ); SaveCopyInUndoList( GetBoard()->m_Modules, UR_MODEDIT );
DeleteTextModule( (TEXTE_MODULE*) GetScreen()->GetCurItem() ); DeleteTextModule( static_cast<TEXTE_MODULE*>( GetScreen()->GetCurItem() ) );
SetCurItem( NULL ); SetCurItem( NULL );
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
break; break;
case ID_POPUP_PCB_MOVE_EDGE: case ID_POPUP_PCB_MOVE_EDGE:
Start_Move_EdgeMod( (EDGE_MODULE*) GetScreen()->GetCurItem(), &dc ); Start_Move_EdgeMod( static_cast<EDGE_MODULE*>( GetScreen()->GetCurItem() ), &dc );
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
break; break;
...@@ -818,7 +818,6 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -818,7 +818,6 @@ 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 )
{ {
TEXTE_MODULE* textmod;
wxPoint pos; wxPoint pos;
double angle = 900; // Necessary +- 900 (+- 90 degrees). double angle = 900; // Necessary +- 900 (+- 90 degrees).
// Be prudent: because RotateMarkedItems is used to rotate some items // Be prudent: because RotateMarkedItems is used to rotate some items
...@@ -827,45 +826,15 @@ void FOOTPRINT_EDIT_FRAME::Transform( MODULE* module, int transform ) ...@@ -827,45 +826,15 @@ void FOOTPRINT_EDIT_FRAME::Transform( MODULE* module, int transform )
switch( transform ) switch( transform )
{ {
case ID_MODEDIT_MODULE_ROTATE: case ID_MODEDIT_MODULE_ROTATE:
#define ROTATE( z ) RotatePoint( (&z), angle ) module->Reference().RotateWithModule( wxPoint(0,0), angle );
RotateMarkedItems( module, wxPoint(0,0), true ); module->Value().RotateWithModule( wxPoint(0,0), angle );
pos = module->Reference().GetTextPosition();
ROTATE( pos );
module->Reference().SetTextPosition( pos );
module->Reference().SetPos0( module->Reference().GetTextPosition() );
module->Reference().m_Orient += angle;
if( module->Reference().m_Orient >= 1800 )
module->Reference().m_Orient -= 1800;
pos = module->Value().GetTextPosition();
ROTATE( pos );
module->Value().SetTextPosition( pos );
module->Value().SetPos0( module->Value().m_Pos );
module->Value().m_Orient += angle;
if( module->Value().m_Orient >= 1800 )
module->Value().m_Orient -= 1800;
RotateMarkedItems( module, wxPoint(0,0), true );
break; break;
case ID_MODEDIT_MODULE_MIRROR: case ID_MODEDIT_MODULE_MIRROR:
// Mirror reference. module->Reference().MirrorWithModule( 0 );
textmod = &module->Reference(); module->Value().MirrorWithModule( 0 );
NEGATE( textmod->m_Pos.x );
NEGATE( textmod->m_Pos0.x );
if( textmod->m_Orient )
textmod->m_Orient = 3600 - textmod->m_Orient;
// Mirror value.
textmod = &module->Value();
NEGATE( textmod->m_Pos.x );
NEGATE( textmod->m_Pos0.x );
if( textmod->m_Orient )
textmod->m_Orient = 3600 - textmod->m_Orient;
// Mirror pads and graphic items of the footprint: // Mirror pads and graphic items of the footprint:
MirrorMarkedItems( module, wxPoint(0,0), true ); MirrorMarkedItems( module, wxPoint(0,0), true );
......
...@@ -34,16 +34,16 @@ void FOOTPRINT_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -34,16 +34,16 @@ void FOOTPRINT_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
switch( item->Type() ) switch( item->Type() )
{ {
case PCB_MODULE_TEXT_T: case PCB_MODULE_TEXT_T:
PlaceTexteModule( (TEXTE_MODULE*) item, DC ); PlaceTexteModule( static_cast<TEXTE_MODULE*>( item ), DC );
break; break;
case PCB_MODULE_EDGE_T: case PCB_MODULE_EDGE_T:
SaveCopyInUndoList( GetBoard()->m_Modules, UR_MODEDIT ); SaveCopyInUndoList( GetBoard()->m_Modules, UR_MODEDIT );
Place_EdgeMod( (EDGE_MODULE*) item ); Place_EdgeMod( static_cast<EDGE_MODULE*>( item ) );
break; break;
case PCB_PAD_T: case PCB_PAD_T:
PlacePad( (D_PAD*) item, DC ); PlacePad( static_cast<D_PAD*>( item ), DC );
break; break;
default: default:
...@@ -313,7 +313,7 @@ bool FOOTPRINT_EDIT_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMen ...@@ -313,7 +313,7 @@ bool FOOTPRINT_EDIT_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMen
HK_EDIT_ITEM ); HK_EDIT_ITEM );
AddMenuItem( PopMenu, ID_POPUP_PCB_EDIT_TEXTMODULE, msg, KiBitmap( edit_text_xpm ) ); AddMenuItem( PopMenu, ID_POPUP_PCB_EDIT_TEXTMODULE, msg, KiBitmap( edit_text_xpm ) );
if( ( (TEXTE_MODULE*) item )->GetType() == TEXTE_MODULE::TEXT_is_DIVERS ) if( ( static_cast<TEXTE_MODULE*>( item ) )->GetType() == TEXTE_MODULE::TEXT_is_DIVERS )
{ {
msg = AddHotkeyName( _("Delete Text Mod." ), g_Module_Editor_Hokeys_Descr, msg = AddHotkeyName( _("Delete Text Mod." ), g_Module_Editor_Hokeys_Descr,
HK_DELETE ); HK_DELETE );
...@@ -444,13 +444,13 @@ void FOOTPRINT_EDIT_FRAME::OnEditItemRequest( wxDC* aDC, BOARD_ITEM* aItem ) ...@@ -444,13 +444,13 @@ void FOOTPRINT_EDIT_FRAME::OnEditItemRequest( wxDC* aDC, BOARD_ITEM* aItem )
switch( aItem->Type() ) switch( aItem->Type() )
{ {
case PCB_PAD_T: case PCB_PAD_T:
InstallPadOptionsFrame( (D_PAD*) aItem ); InstallPadOptionsFrame( static_cast<D_PAD*>( aItem ) );
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
break; break;
case PCB_MODULE_T: case PCB_MODULE_T:
{ {
DIALOG_MODULE_MODULE_EDITOR dialog( this, (MODULE*) aItem ); DIALOG_MODULE_MODULE_EDITOR dialog( this, static_cast<MODULE*>( aItem ) );
int ret = dialog.ShowModal(); int ret = dialog.ShowModal();
GetScreen()->GetCurItem()->ClearFlags(); GetScreen()->GetCurItem()->ClearFlags();
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
...@@ -461,13 +461,13 @@ void FOOTPRINT_EDIT_FRAME::OnEditItemRequest( wxDC* aDC, BOARD_ITEM* aItem ) ...@@ -461,13 +461,13 @@ void FOOTPRINT_EDIT_FRAME::OnEditItemRequest( wxDC* aDC, BOARD_ITEM* aItem )
break; break;
case PCB_MODULE_TEXT_T: case PCB_MODULE_TEXT_T:
InstallTextModOptionsFrame( (TEXTE_MODULE*) aItem, aDC ); InstallTextModOptionsFrame( static_cast<TEXTE_MODULE*>( aItem ), aDC );
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
break; break;
case PCB_MODULE_EDGE_T : case PCB_MODULE_EDGE_T :
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
InstallFootprintBodyItemPropertiesDlg( (EDGE_MODULE*) aItem ); InstallFootprintBodyItemPropertiesDlg( static_cast<EDGE_MODULE*>( aItem ) );
m_canvas->Refresh(); m_canvas->Refresh();
break; break;
......
...@@ -35,8 +35,13 @@ ...@@ -35,8 +35,13 @@
#include <msgpanel.h> #include <msgpanel.h>
#include <class_board.h> #include <class_board.h>
#include <class_drawsegment.h>
#include <class_dimension.h>
#include <class_zone.h> #include <class_zone.h>
#include <class_pcb_text.h> #include <class_pcb_text.h>
#include <class_text_mod.h>
#include <class_module.h>
#include <class_mire.h>
#include <project.h> #include <project.h>
#include <pcbnew.h> #include <pcbnew.h>
...@@ -71,7 +76,7 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) ...@@ -71,7 +76,7 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
} }
else else
{ {
End_Move_Zone_Corner_Or_Outlines( aDC, (ZONE_CONTAINER*) DrawStruct ); End_Move_Zone_Corner_Or_Outlines( aDC, static_cast<ZONE_CONTAINER*>( DrawStruct ) );
} }
exit = true; exit = true;
...@@ -81,41 +86,41 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) ...@@ -81,41 +86,41 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
case PCB_VIA_T: case PCB_VIA_T:
if( DrawStruct->IsDragging() ) if( DrawStruct->IsDragging() )
{ {
PlaceDraggedOrMovedTrackSegment( (TRACK*) DrawStruct, aDC ); PlaceDraggedOrMovedTrackSegment( static_cast<TRACK*>( DrawStruct ), aDC );
exit = true; exit = true;
} }
break; break;
case PCB_TEXT_T: case PCB_TEXT_T:
Place_Texte_Pcb( (TEXTE_PCB*) DrawStruct, aDC ); Place_Texte_Pcb( static_cast<TEXTE_PCB*>( DrawStruct ), aDC );
exit = true; exit = true;
break; break;
case PCB_MODULE_TEXT_T: case PCB_MODULE_TEXT_T:
PlaceTexteModule( (TEXTE_MODULE*) DrawStruct, aDC ); PlaceTexteModule( static_cast<TEXTE_MODULE*>( DrawStruct ), aDC );
exit = true; exit = true;
break; break;
case PCB_PAD_T: case PCB_PAD_T:
PlacePad( (D_PAD*) DrawStruct, aDC ); PlacePad( static_cast<D_PAD*>( DrawStruct ), aDC );
exit = true; exit = true;
break; break;
case PCB_MODULE_T: case PCB_MODULE_T:
PlaceModule( (MODULE*) DrawStruct, aDC ); PlaceModule( static_cast<MODULE*>( DrawStruct ), aDC );
exit = true; exit = true;
break; break;
case PCB_TARGET_T: case PCB_TARGET_T:
PlaceTarget( (PCB_TARGET*) DrawStruct, aDC ); PlaceTarget( static_cast<PCB_TARGET*>( DrawStruct ), aDC );
exit = true; exit = true;
break; break;
case PCB_LINE_T: case PCB_LINE_T:
if( no_tool ) // when no tools: existing item moving. if( no_tool ) // when no tools: existing item moving.
{ {
Place_DrawItem( (DRAWSEGMENT*) DrawStruct, aDC ); Place_DrawItem( static_cast<DRAWSEGMENT*>( DrawStruct ), aDC );
exit = true; exit = true;
} }
...@@ -124,7 +129,7 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) ...@@ -124,7 +129,7 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
case PCB_DIMENSION_T: case PCB_DIMENSION_T:
if( ! DrawStruct->IsNew() ) if( ! DrawStruct->IsNew() )
{ // We are moving the text of an existing dimension. Place it { // We are moving the text of an existing dimension. Place it
PlaceDimensionText( (DIMENSION*) DrawStruct, aDC ); PlaceDimensionText( static_cast<DIMENSION*>( DrawStruct ), aDC );
exit = true; exit = true;
} }
break; break;
...@@ -552,39 +557,39 @@ void PCB_EDIT_FRAME::OnEditItemRequest( wxDC* aDC, BOARD_ITEM* aItem ) ...@@ -552,39 +557,39 @@ void PCB_EDIT_FRAME::OnEditItemRequest( wxDC* aDC, BOARD_ITEM* aItem )
{ {
case PCB_TRACE_T: case PCB_TRACE_T:
case PCB_VIA_T: case PCB_VIA_T:
Edit_TrackSegm_Width( aDC, (TRACK*) aItem ); Edit_TrackSegm_Width( aDC, static_cast<TRACK*>( aItem ) );
break; break;
case PCB_TEXT_T: case PCB_TEXT_T:
InstallTextPCBOptionsFrame( (TEXTE_PCB*) aItem, aDC ); InstallTextPCBOptionsFrame( static_cast<TEXTE_PCB*>( aItem ), aDC );
break; break;
case PCB_PAD_T: case PCB_PAD_T:
InstallPadOptionsFrame( (D_PAD*) aItem ); InstallPadOptionsFrame( static_cast<D_PAD*>( aItem ) );
break; break;
case PCB_MODULE_T: case PCB_MODULE_T:
InstallModuleOptionsFrame( (MODULE*) aItem, aDC ); InstallModuleOptionsFrame( static_cast<MODULE*>( aItem ), aDC );
break; break;
case PCB_TARGET_T: case PCB_TARGET_T:
ShowTargetOptionsDialog( (PCB_TARGET*) aItem, aDC ); ShowTargetOptionsDialog( static_cast<PCB_TARGET*>( aItem ), aDC );
break; break;
case PCB_DIMENSION_T: case PCB_DIMENSION_T:
ShowDimensionPropertyDialog( (DIMENSION*) aItem, aDC ); ShowDimensionPropertyDialog( static_cast<DIMENSION*>( aItem ), aDC );
break; break;
case PCB_MODULE_TEXT_T: case PCB_MODULE_TEXT_T:
InstallTextModOptionsFrame( (TEXTE_MODULE*) aItem, aDC ); InstallTextModOptionsFrame( static_cast<TEXTE_MODULE*>( aItem ), aDC );
break; break;
case PCB_LINE_T: case PCB_LINE_T:
InstallGraphicItemPropertiesDialog( (DRAWSEGMENT*) aItem, aDC ); InstallGraphicItemPropertiesDialog( static_cast<DRAWSEGMENT*>( aItem ), aDC );
break; break;
case PCB_ZONE_AREA_T: case PCB_ZONE_AREA_T:
Edit_Zone_Params( aDC, (ZONE_CONTAINER*) aItem ); Edit_Zone_Params( aDC, static_cast<ZONE_CONTAINER*>( aItem ) );
break; break;
default: default:
......
...@@ -180,11 +180,11 @@ bool PCB_EDIT_FRAME::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) ...@@ -180,11 +180,11 @@ bool PCB_EDIT_FRAME::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
break; break;
case PCB_PAD_T: case PCB_PAD_T:
createPopUpMenuForFpPads( (D_PAD*) item, aPopMenu ); createPopUpMenuForFpPads( static_cast<D_PAD*>( item ), aPopMenu );
break; break;
case PCB_MODULE_TEXT_T: case PCB_MODULE_TEXT_T:
createPopUpMenuForFpTexts( (TEXTE_MODULE*) item, aPopMenu ); createPopUpMenuForFpTexts( static_cast<TEXTE_MODULE*>( item ), aPopMenu );
break; break;
case PCB_LINE_T: // Some graphic items on technical layers case PCB_LINE_T: // Some graphic items on technical layers
......
...@@ -214,54 +214,53 @@ bool PCB_PAINTER::Draw( const VIEW_ITEM* aItem, int aLayer ) ...@@ -214,54 +214,53 @@ bool PCB_PAINTER::Draw( const VIEW_ITEM* aItem, int aLayer )
{ {
case PCB_ZONE_T: case PCB_ZONE_T:
case PCB_TRACE_T: case PCB_TRACE_T:
draw( (const TRACK*) item, aLayer ); draw( static_cast<const TRACK*>( item ), aLayer );
break; break;
case PCB_VIA_T: case PCB_VIA_T:
draw( (const VIA*) item, aLayer ); draw( static_cast<const VIA*>( item ), aLayer );
break; break;
case PCB_PAD_T: case PCB_PAD_T:
draw( (const D_PAD*) item, aLayer ); draw( static_cast<const D_PAD*>( item ), aLayer );
break; break;
case PCB_LINE_T: case PCB_LINE_T:
case PCB_MODULE_EDGE_T: case PCB_MODULE_EDGE_T:
draw( (DRAWSEGMENT*) item, aLayer ); draw( static_cast<const DRAWSEGMENT*>( item ), aLayer );
break; break;
case PCB_TEXT_T: case PCB_TEXT_T:
draw( (TEXTE_PCB*) item, aLayer ); draw( static_cast<const TEXTE_PCB*>( item ), aLayer );
break; break;
case PCB_MODULE_TEXT_T: case PCB_MODULE_TEXT_T:
draw( (TEXTE_MODULE*) item, aLayer ); draw( static_cast<const TEXTE_MODULE*>( item ), aLayer );
break; break;
case PCB_MODULE_T: case PCB_MODULE_T:
draw( (MODULE*) item, aLayer ); draw( static_cast<const MODULE*>( item ), aLayer );
break; break;
case PCB_ZONE_AREA_T: case PCB_ZONE_AREA_T:
draw( (ZONE_CONTAINER*) item ); draw( static_cast<const ZONE_CONTAINER*>( item ) );
break; break;
case PCB_DIMENSION_T: case PCB_DIMENSION_T:
draw( (DIMENSION*) item, aLayer ); draw( static_cast<const DIMENSION*>( item ), aLayer );
break; break;
case PCB_TARGET_T: case PCB_TARGET_T:
draw( (PCB_TARGET*) item ); draw( static_cast<const PCB_TARGET*>( item ) );
break; break;
case PCB_MARKER_T: case PCB_MARKER_T:
draw( (MARKER_PCB*) item ); draw( static_cast<const MARKER_PCB*>( item ) );
break; break;
default: default:
// Painter does not know how to draw the object // Painter does not know how to draw the object
return false; return false;
break;
} }
return true; return true;
......
...@@ -404,17 +404,18 @@ static void Print_Module( EDA_DRAW_PANEL* aPanel, wxDC* aDC, MODULE* aModule, ...@@ -404,17 +404,18 @@ static void Print_Module( EDA_DRAW_PANEL* aPanel, wxDC* aDC, MODULE* aModule,
switch( item->Type() ) switch( item->Type() )
{ {
case PCB_MODULE_TEXT_T: case PCB_MODULE_TEXT_T:
{
if( !( mlayer & aMask ).any() ) if( !( mlayer & aMask ).any() )
break; break;
TEXTE_MODULE* textMod; TEXTE_MODULE* textMod = static_cast<TEXTE_MODULE*>( item );
textMod = (TEXTE_MODULE*) item;
textMod->Draw( aPanel, aDC, aDraw_mode ); textMod->Draw( aPanel, aDC, aDraw_mode );
break; break;
}
case PCB_MODULE_EDGE_T: case PCB_MODULE_EDGE_T:
{ {
EDGE_MODULE* edge = (EDGE_MODULE*) item; EDGE_MODULE* edge = static_cast<EDGE_MODULE*>( item );
if( !aMask[edge->GetLayer()] ) if( !aMask[edge->GetLayer()] )
break; break;
......
...@@ -489,7 +489,7 @@ void EDIT_TOOL::remove( BOARD_ITEM* aItem ) ...@@ -489,7 +489,7 @@ void EDIT_TOOL::remove( BOARD_ITEM* aItem )
DisplayError( getEditFrame<PCB_BASE_FRAME>(), _( "Cannot delete VALUE!" ) ); DisplayError( getEditFrame<PCB_BASE_FRAME>(), _( "Cannot delete VALUE!" ) );
return; return;
default: // suppress warnings case TEXTE_MODULE::TEXT_is_DIVERS: // suppress warnings
break; break;
} }
} }
......
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