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