Commit 2fb2ab0d authored by Wayne Stambaugh's avatar Wayne Stambaugh

Refactor PCBNew selection clarification menu text code.

* Move menu text code from base board item object to the appropriate
  object.
* Add helper to get board layer to base board item object.
parent 9a51dc75
...@@ -151,17 +151,6 @@ public: ...@@ -151,17 +151,6 @@ public:
} }
/**
* Function MenuText
* returns the text to use in any menu type UI control which must uniquely
* identify this item.
* @param aPcb The PCB in which this item resides, needed for Net lookup.
* @return wxString
* @todo: maybe: make this virtual and split into each derived class
*/
wxString MenuText( const BOARD* aPcb ) const;
/** /**
* Function MenuIcon * Function MenuIcon
* @return const char** - The XPM to use in any UI control which can help * @return const char** - The XPM to use in any UI control which can help
...@@ -224,8 +213,17 @@ public: ...@@ -224,8 +213,17 @@ public:
* returns the BOARD in which this BOARD_ITEM resides, or NULL if none. * returns the BOARD in which this BOARD_ITEM resides, or NULL if none.
*/ */
virtual BOARD* GetBoard() const; virtual BOARD* GetBoard() const;
/**
* Function GetLayerName
* returns the name of the PCB layer on which the item resides.
*
* @return wxString containing the layer name associated with this item.
*/
wxString GetLayerName() const;
}; };
class NETCLASS; class NETCLASS;
/** /**
......
...@@ -14,9 +14,7 @@ ...@@ -14,9 +14,7 @@
#include "bitmaps.h" #include "bitmaps.h"
/********************************************************/
wxString BOARD_ITEM::ShowShape( Track_Shapes aShape ) wxString BOARD_ITEM::ShowShape( Track_Shapes aShape )
/********************************************************/
{ {
switch( aShape ) switch( aShape )
{ {
...@@ -31,213 +29,11 @@ wxString BOARD_ITEM::ShowShape( Track_Shapes aShape ) ...@@ -31,213 +29,11 @@ wxString BOARD_ITEM::ShowShape( Track_Shapes aShape )
} }
/**
* return a specific comment for "this". Used in pop up menus
* @param aPcb = the parent board
*/
wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const
{
wxString text;
wxString msg;
wxString temp;
NETINFO_ITEM* net;
const BOARD_ITEM* item = this;
D_PAD * pad;
switch( item->Type() )
{
case TYPE_MODULE:
text << _( "Footprint" ) << wxT( " " ) << ( (MODULE*) item )->GetReference();
text << wxT( " (" ) << aPcb->GetLayerName( item->m_Layer ).Trim() << wxT( ")" );
break;
case TYPE_PAD:
pad = (D_PAD *) this;
text << _( "Pad" ) << wxT( " \"" ) << pad->ReturnStringPadName() << wxT( "\" (" );
if ( (pad->m_Masque_Layer & ALL_CU_LAYERS) == ALL_CU_LAYERS )
text << _("all copper layers");
else if( (pad->m_Masque_Layer & LAYER_BACK) == LAYER_BACK )
text << aPcb->GetLayerName( LAYER_N_BACK ).Trim();
else if( (pad->m_Masque_Layer & LAYER_FRONT) == LAYER_FRONT )
text << aPcb->GetLayerName( LAYER_N_FRONT );
else
text << _("???");
text << _( ") of " ) << ( (MODULE*) GetParent() )->GetReference();
break;
case TYPE_DRAWSEGMENT:
text << _( "Pcb Graphic" ) << wxT(": ")
<< ShowShape( (Track_Shapes) ((DRAWSEGMENT*)item)->m_Shape )
<< wxChar(' ') << _("Length:") << valeur_param( (int) ((DRAWSEGMENT*)item)->GetLength(), temp )
<< _( " on " ) << aPcb->GetLayerName( item->GetLayer() ).Trim();
break;
case TYPE_TEXTE:
text << _( "Pcb Text" ) << wxT( " " );
if( ( (TEXTE_PCB*) item )->m_Text.Len() < 12 )
text << ( (TEXTE_PCB*) item )->m_Text;
else
text += ( (TEXTE_PCB*) item )->m_Text.Left( 10 ) + wxT( ".." );
text << _( " on " ) << aPcb->GetLayerName( item->GetLayer() ).Trim();
break;
case TYPE_TEXTE_MODULE:
switch( ( (TEXTE_MODULE*) item )->m_Type )
{
case TEXT_is_REFERENCE:
text << _( "Reference" ) << wxT( " " ) << ( (TEXTE_MODULE*) item )->m_Text;
break;
case TEXT_is_VALUE:
text << _( "Value" ) << wxT( " " ) << ( (TEXTE_MODULE*) item )->m_Text << _( " of " )
<< ( (MODULE*) GetParent() )->GetReference();
break;
default: // wrap this one in quotes:
text << _( "Text" ) << wxT( " \"" ) << ( (TEXTE_MODULE*) item )->m_Text <<
wxT( "\"" ) << _( " of " )
<< ( (MODULE*) GetParent() )->GetReference();
break;
}
break;
case TYPE_EDGE_MODULE:
text << _( "Graphic" ) << wxT( " " );
text << ShowShape( (Track_Shapes) ( (EDGE_MODULE*) item )->m_Shape );
text << wxT( " (" ) << aPcb->GetLayerName( ((EDGE_MODULE*) item )->m_Layer ).Trim() << wxT( ")" );
text << _( " of " )
<< ( (MODULE*) GetParent() )->GetReference();
break;
case TYPE_TRACK:
// deleting tracks requires all the information we can get to
// disambiguate all the choices under the cursor!
text << _( "Track" ) << wxT( " " ) << ((TRACK*)item)->ShowWidth();
net = aPcb->FindNet( ((TRACK*)item)->GetNet() );
if( net )
{
text << wxT( " [" ) << net->GetNetname() << wxT( "]" );
}
text << _( " on " ) << aPcb->GetLayerName( item->GetLayer() ).Trim()
<< wxT(" ") << _("Net:") << ((TRACK*)item)->GetNet()
<< wxT(" ") << _("Length:") << valeur_param( (int) ((TRACK*)item)->GetLength(), temp );
break;
case TYPE_ZONE_CONTAINER:
text = _( "Zone Outline" );
{
ZONE_CONTAINER* area = (ZONE_CONTAINER*) this;
int ncont = area->m_Poly->GetContour(area->m_CornerSelection);
if( ncont )
text << wxT(" ") << _("(Cutout)");
}
text << wxT( " " );
{
wxString TimeStampText;
TimeStampText.Printf( wxT( "(%8.8X)" ), item->m_TimeStamp );
text << TimeStampText;
}
if ( !((ZONE_CONTAINER*) item)->IsOnCopperLayer() )
{
text << wxT( " [" ) << _("Not on copper layer") << wxT( "]" );
}
else if( ((ZONE_CONTAINER*) item)->GetNet() >= 0 )
{
net = aPcb->FindNet( ( (ZONE_CONTAINER*) item )->GetNet() );
if( net )
{
text << wxT( " [" ) << net->GetNetname() << wxT( "]" );
}
}
else // A netcode < 0 is an error flag (Netname not found or area not initialised)
{
text << wxT( " [" ) << ( (ZONE_CONTAINER*) item )->m_Netname << wxT( "]" );
text << wxT(" <") << _("Not Found") << wxT(">");
}
text << _( " on " ) << aPcb->GetLayerName( item->GetLayer() ).Trim();
break;
case TYPE_ZONE:
text = _( "Zone" );
text << wxT( " " );
{
wxString TimeStampText;
TimeStampText.Printf( wxT( "(%8.8X)" ), item->m_TimeStamp );
text << TimeStampText;
}
net = aPcb->FindNet( ( (SEGZONE*) item )->GetNet() );
if( net )
{
text << wxT( " [" ) << net->GetNetname() << wxT( "]" );
}
text << _( " on " ) << aPcb->GetLayerName( item->GetLayer() ).Trim();
break;
case TYPE_VIA:
{
SEGVIA* via = (SEGVIA*) item;
text << _( "Via" ) << wxT( " " ) << via->ShowWidth();
int shape = via->Shape();
if( shape == VIA_BLIND_BURIED )
text << wxT(" ") << _( "Blind/Buried" );
else if( shape == VIA_MICROVIA )
text << wxT(" ") << _("Micro Via");
// else say nothing about normal (through) vias
net = aPcb->FindNet( via->GetNet() );
if( net )
{
text << wxT( " [" ) << net->GetNetname() << wxT( "]" );
}
text << wxChar(' ') << _("Net:") << via->GetNet();
if( shape != VIA_THROUGH )
{
// say which layers, only two for now
int topLayer;
int botLayer;
via->ReturnLayerPair( &topLayer, &botLayer );
text << _( " on " ) << aPcb->GetLayerName( topLayer).Trim() << wxT(" <-> ")
<< aPcb->GetLayerName( botLayer ).Trim();
}
}
break;
case TYPE_MARKER_PCB:
text << _( "Marker" ) << wxT( " @(" ) << ((MARKER_PCB*)item)->GetPos().x
<< wxT(",") << ((MARKER_PCB*)item)->GetPos().y << wxT(")");
break;
case TYPE_DIMENSION:
text << _( "Dimension" ) << wxT( " \"" ) << ( (DIMENSION*) item )->GetText() << wxT( "\"" );
break;
case TYPE_MIRE:
valeur_param( ((MIREPCB*)item)->m_Size, msg );
text << _( "Target" ) << _( " on " ) << aPcb->GetLayerName( item->GetLayer() ).Trim()
<< wxT( " " ) << _( "size" ) << wxT( " " ) << msg
;
break;
default:
text << item->GetClass() << wxT( " Unexpected item type: BUG!!" );
break;
}
return text;
}
/*****************************************/
const char** BOARD_ITEM::MenuIcon() const
/*****************************************/
/** return a specific icon pointer (an xpm icon) for "this". Used in pop up menus /** return a specific icon pointer (an xpm icon) for "this". Used in pop up menus
* @return an icon pointer (can be NULL) * @return an icon pointer (can be NULL)
*/ */
const char** BOARD_ITEM::MenuIcon() const
{ {
const char** xpm; const char** xpm;
const BOARD_ITEM* item = this; const BOARD_ITEM* item = this;
...@@ -301,6 +97,7 @@ const char** BOARD_ITEM::MenuIcon() const ...@@ -301,6 +97,7 @@ const char** BOARD_ITEM::MenuIcon() const
return (const char**) xpm; return (const char**) xpm;
} }
void BOARD_ITEM::UnLink() void BOARD_ITEM::UnLink()
{ {
DLIST<BOARD_ITEM>* list = (DLIST<BOARD_ITEM>*) GetList(); DLIST<BOARD_ITEM>* list = (DLIST<BOARD_ITEM>*) GetList();
...@@ -323,3 +120,17 @@ BOARD* BOARD_ITEM::GetBoard() const ...@@ -323,3 +120,17 @@ BOARD* BOARD_ITEM::GetBoard() const
return NULL; return NULL;
} }
wxString BOARD_ITEM::GetLayerName() const
{
wxString layerName;
BOARD* board = GetBoard();
if( board != NULL )
return board->GetLayerName( m_Layer ).Trim();
wxFAIL_MSG( wxT( "No board found for board item type " ) + GetClass() );
layerName = _( "** undefined layer **" );
return layerName;
}
...@@ -42,7 +42,7 @@ void DIMENSION::SetText( const wxString& NewText ) ...@@ -42,7 +42,7 @@ void DIMENSION::SetText( const wxString& NewText )
/* Return the dimension text /* Return the dimension text
*/ */
wxString DIMENSION::GetText( void ) wxString DIMENSION::GetText( void ) const
{ {
return m_Text->m_Text; return m_Text->m_Text;
} }
...@@ -430,7 +430,7 @@ void DIMENSION::AdjustDimensionDetails( bool aDoNotChangeText ) ...@@ -430,7 +430,7 @@ void DIMENSION::AdjustDimensionDetails( bool aDoNotChangeText )
/* Init layer : */ /* Init layer : */
m_Text->SetLayer( GetLayer() ); m_Text->SetLayer( GetLayer() );
/* calculate the size of the cdimension /* calculate the size of the dimension
* (text + line above the text) */ * (text + line above the text) */
ii = m_Text->m_Size.y + ii = m_Text->m_Size.y +
m_Text->m_Thickness + (m_Width * 3); m_Text->m_Thickness + (m_Width * 3);
...@@ -777,3 +777,13 @@ EDA_RECT DIMENSION::GetBoundingBox() const ...@@ -777,3 +777,13 @@ EDA_RECT DIMENSION::GetBoundingBox() const
return bBox; return bBox;
} }
wxString DIMENSION::GetSelectMenuText() const
{
wxString text;
text << _( "Dimension" ) << wxT( " \"" ) << GetText() << wxT( "\"" );
return text;
}
...@@ -59,7 +59,7 @@ public: ...@@ -59,7 +59,7 @@ public:
bool Save( FILE* aFile ) const; bool Save( FILE* aFile ) const;
void SetText( const wxString& NewText ); void SetText( const wxString& NewText );
wxString GetText( void ); wxString GetText( void ) const;
void Copy( DIMENSION* source ); void Copy( DIMENSION* source );
...@@ -134,6 +134,8 @@ public: ...@@ -134,6 +134,8 @@ public:
} }
EDA_RECT GetBoundingBox() const; EDA_RECT GetBoundingBox() const;
virtual wxString GetSelectMenuText() const;
}; };
#endif // #define DIMENSION_H #endif // #define DIMENSION_H
...@@ -495,6 +495,19 @@ bool DRAWSEGMENT::HitTest( EDA_RECT& refArea ) ...@@ -495,6 +495,19 @@ bool DRAWSEGMENT::HitTest( EDA_RECT& refArea )
} }
wxString DRAWSEGMENT::GetSelectMenuText() const
{
wxString text;
wxString temp;
text << _( "Pcb Graphic" ) << wxT(": ") << ShowShape( (Track_Shapes)m_Shape )
<< wxChar(' ') << _("Length:") << valeur_param( GetLength(), temp )
<< _( " on " ) << GetLayerName();
return text;
}
#if defined(DEBUG) #if defined(DEBUG)
/** /**
* Function Show * Function Show
......
...@@ -169,13 +169,13 @@ public: ...@@ -169,13 +169,13 @@ public:
* clearance when the circle is approxiamted by segment bigger or equal * clearance when the circle is approxiamted by segment bigger or equal
* to the real clearance value (usually near from 1.0) * to the real clearance value (usually near from 1.0)
*/ */
void TransformShapeWithClearanceToPolygon( void TransformShapeWithClearanceToPolygon( std::vector <CPolyPt>& aCornerBuffer,
std::vector <CPolyPt>& aCornerBuffer,
int aClearanceValue, int aClearanceValue,
int int aCircleToSegmentsCount,
aCircleToSegmentsCount,
double aCorrectionFactor ); double aCorrectionFactor );
virtual wxString GetSelectMenuText() const;
#if defined(DEBUG) #if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ); void Show( int nestLevel, std::ostream& os );
......
...@@ -601,8 +601,20 @@ bool EDGE_MODULE::HitTest( EDA_RECT& refArea ) ...@@ -601,8 +601,20 @@ bool EDGE_MODULE::HitTest( EDA_RECT& refArea )
return false; return false;
} }
#if defined(DEBUG)
wxString EDGE_MODULE::GetSelectMenuText() const
{
wxString text;
text << _( "Graphic" ) << wxT( " " ) << ShowShape( (Track_Shapes) m_Shape );
text << wxT( " (" ) << GetLayerName() << wxT( ")" );
text << _( " of " ) << ( (MODULE*) GetParent() )->GetReference();
return text;
}
#if defined(DEBUG)
/** /**
* Function Show * Function Show
......
...@@ -145,16 +145,16 @@ public: ...@@ -145,16 +145,16 @@ public:
* @param aClearanceValue = the clearance around the pad * @param aClearanceValue = the clearance around the pad
* @param aCircleToSegmentsCount = the number of segments to approximate a circle * @param aCircleToSegmentsCount = the number of segments to approximate a circle
* @param aCorrectionFactor = the correction to apply to circles radius to keep * @param aCorrectionFactor = the correction to apply to circles radius to keep
* clearance when the circle is approxiamted by segment bigger or equal * clearance when the circle is approximated by segment bigger or equal
* to the real clearance value (usually near from 1.0) * to the real clearance value (usually near from 1.0)
*/ */
void TransformShapeWithClearanceToPolygon( void TransformShapeWithClearanceToPolygon( std::vector <CPolyPt>& aCornerBuffer,
std::vector <CPolyPt>& aCornerBuffer,
int aClearanceValue, int aClearanceValue,
int int aCircleToSegmentsCount,
aCircleToSegmentsCount,
double aCorrectionFactor ); double aCorrectionFactor );
virtual wxString GetSelectMenuText() const;
#if defined(DEBUG) #if defined(DEBUG)
/** /**
......
/*****************************************************************************/ /*****************************************************************************/
/* Functions to handle markers used to show somthing (usually a drc problem) */ /* Functions to handle markers used to show something (usually a drc problem) */
/*****************************************************************************/ /*****************************************************************************/
/* file class_marker.cpp */ /* file class_marker.cpp */
...@@ -93,7 +93,7 @@ void MARKER_PCB::Rotate(const wxPoint& aRotCentre, int aAngle) ...@@ -93,7 +93,7 @@ void MARKER_PCB::Rotate(const wxPoint& aRotCentre, int aAngle)
/** /**
* Function Flip * Function Flip
* Flip this object, i.e. change the board side for this object * Flip this object, i.e. change the board side for this object
* this function has not reeally sense for a marker. * this function has not really sense for a marker.
* It moves just the marker to keep its position on board, when the board is flipped * It moves just the marker to keep its position on board, when the board is flipped
* @param aCentre - the rotation point. * @param aCentre - the rotation point.
*/ */
...@@ -102,3 +102,12 @@ void MARKER_PCB::Flip(const wxPoint& aCentre ) ...@@ -102,3 +102,12 @@ void MARKER_PCB::Flip(const wxPoint& aCentre )
m_Pos.y = aCentre.y - (m_Pos.y - aCentre.y); m_Pos.y = aCentre.y - (m_Pos.y - aCentre.y);
} }
wxString MARKER_PCB::GetSelectMenuText() const
{
wxString text;
text << _( "Marker" ) << wxT( " @(" ) << GetPos().x << wxT( "," ) << GetPos().y << wxT( ")" );
return text;
}
...@@ -114,6 +114,8 @@ public: ...@@ -114,6 +114,8 @@ public:
// "pure" virtual-ness // "pure" virtual-ness
return true; return true;
} }
virtual wxString GetSelectMenuText() const;
}; };
......
...@@ -234,3 +234,17 @@ EDA_RECT MIREPCB::GetBoundingBox() const ...@@ -234,3 +234,17 @@ EDA_RECT MIREPCB::GetBoundingBox() const
return bBox; return bBox;
} }
wxString MIREPCB::GetSelectMenuText() const
{
wxString text;
wxString msg;
valeur_param( m_Size, msg );
text << _( "Target" ) << _( " on " ) << GetLayerName() << wxT( " " ) << _( "size" )
<< wxT( " " ) << msg;
return text;
}
...@@ -88,6 +88,8 @@ public: ...@@ -88,6 +88,8 @@ public:
bool HitTest( EDA_RECT& refArea ); bool HitTest( EDA_RECT& refArea );
EDA_RECT GetBoundingBox() const; EDA_RECT GetBoundingBox() const;
virtual wxString GetSelectMenuText() const;
}; };
......
...@@ -720,7 +720,7 @@ EDA_RECT MODULE::GetFootPrintRect() const ...@@ -720,7 +720,7 @@ EDA_RECT MODULE::GetFootPrintRect() const
for( EDGE_MODULE* edge = (EDGE_MODULE*) m_Drawings.GetFirst(); edge; edge = edge->Next() ) for( EDGE_MODULE* edge = (EDGE_MODULE*) m_Drawings.GetFirst(); edge; edge = edge->Next() )
{ {
if( edge->Type() != TYPE_EDGE_MODULE ) // Shoud not occur if( edge->Type() != TYPE_EDGE_MODULE ) // Should not occur
continue; continue;
area.Merge( edge->GetBoundingBox() ); area.Merge( edge->GetBoundingBox() );
...@@ -1004,6 +1004,17 @@ SEARCH_RESULT MODULE::Visit( INSPECTOR* inspector, const void* testData, ...@@ -1004,6 +1004,17 @@ SEARCH_RESULT MODULE::Visit( INSPECTOR* inspector, const void* testData,
} }
wxString MODULE::GetSelectMenuText() const
{
wxString text;
text << _( "Footprint" ) << wxT( " " ) << GetReference();
text << wxT( " (" ) << GetLayerName() << wxT( ")" );
return text;
}
#if defined(DEBUG) #if defined(DEBUG)
/** /**
......
...@@ -274,7 +274,7 @@ public: ...@@ -274,7 +274,7 @@ public:
* Function GetReference * Function GetReference
* @return const wxString& - the reference designator text. * @return const wxString& - the reference designator text.
*/ */
const wxString& GetReference() const wxString& GetReference() const
{ {
return m_Reference->m_Text; return m_Reference->m_Text;
} }
...@@ -328,6 +328,7 @@ public: ...@@ -328,6 +328,7 @@ public:
return wxT( "MODULE" ); return wxT( "MODULE" );
} }
virtual wxString GetSelectMenuText() const;
#if defined(DEBUG) #if defined(DEBUG)
......
...@@ -144,7 +144,7 @@ const wxPoint D_PAD::ReturnShapePos() ...@@ -144,7 +144,7 @@ const wxPoint D_PAD::ReturnShapePos()
/* Return pad name as string in a wxString /* Return pad name as string in a wxString
*/ */
wxString D_PAD::ReturnStringPadName() wxString D_PAD::ReturnStringPadName() const
{ {
wxString name; wxString name;
...@@ -155,7 +155,7 @@ wxString D_PAD::ReturnStringPadName() ...@@ -155,7 +155,7 @@ wxString D_PAD::ReturnStringPadName()
/* Return pad name as string in a buffer /* Return pad name as string in a buffer
*/ */
void D_PAD::ReturnStringPadName( wxString& text ) void D_PAD::ReturnStringPadName( wxString& text ) const
{ {
int ii; int ii;
...@@ -871,7 +871,7 @@ int D_PAD::Compare( const D_PAD* padref, const D_PAD* padcmp ) ...@@ -871,7 +871,7 @@ int D_PAD::Compare( const D_PAD* padref, const D_PAD* padcmp )
#if defined(DEBUG) #if defined(DEBUG)
// @todo: could this be useable elsewhere also? // @todo: could this be usable elsewhere also?
static const char* ShowPadType( int aPadType ) static const char* ShowPadType( int aPadType )
{ {
switch( aPadType ) switch( aPadType )
...@@ -916,6 +916,27 @@ static const char* ShowPadAttr( int aPadAttr ) ...@@ -916,6 +916,27 @@ static const char* ShowPadAttr( int aPadAttr )
} }
wxString D_PAD::GetSelectMenuText() const
{
wxString text;
text << _( "Pad" ) << wxT( " \"" ) << ReturnStringPadName() << wxT( "\" (" );
if ( (m_Masque_Layer & ALL_CU_LAYERS) == ALL_CU_LAYERS )
text << _("all copper layers");
else if( (m_Masque_Layer & LAYER_BACK) == LAYER_BACK )
text << GetLayerName();
else if( (m_Masque_Layer & LAYER_FRONT) == LAYER_FRONT )
text << GetLayerName();
else
text << _( "???" );
text << _( ") of " ) << ( (MODULE*) GetParent() )->GetReference();
return text;
}
/** /**
* Function Show * Function Show
* is used to output the object tree, currently for debugging only. * is used to output the object tree, currently for debugging only.
......
...@@ -26,7 +26,7 @@ class Pcb3D_GLCanvas; ...@@ -26,7 +26,7 @@ class Pcb3D_GLCanvas;
#define PAD_HOLE_NOT_PLATED_DEFAULT_LAYERS LAYER_BACK | SILKSCREEN_LAYER_FRONT | \ #define PAD_HOLE_NOT_PLATED_DEFAULT_LAYERS LAYER_BACK | SILKSCREEN_LAYER_FRONT | \
SOLDERMASK_LAYER_BACK | SOLDERMASK_LAYER_FRONT SOLDERMASK_LAYER_BACK | SOLDERMASK_LAYER_FRONT
// Helper class to staore parameters used to draw a pad // Helper class to store parameters used to draw a pad
class PAD_DRAWINFO class PAD_DRAWINFO
{ {
public: public:
...@@ -177,7 +177,7 @@ public: ...@@ -177,7 +177,7 @@ public:
* @param aClearanceValue = the clearance around the pad * @param aClearanceValue = the clearance around the pad
* @param aCircleToSegmentsCount = the number of segments to approximate a circle * @param aCircleToSegmentsCount = the number of segments to approximate a circle
* @param aCorrectionFactor = the correction to apply to circles radius to keep * @param aCorrectionFactor = the correction to apply to circles radius to keep
* clearance when the circle is approxiamted by segment bigger or equal * clearance when the circle is approximated by segment bigger or equal
* to the real clearance value (usually near from 1.0) * to the real clearance value (usually near from 1.0)
*/ */
void TransformShapeWithClearanceToPolygon( std::vector <CPolyPt>& aCornerBuffer, void TransformShapeWithClearanceToPolygon( std::vector <CPolyPt>& aCornerBuffer,
...@@ -276,8 +276,8 @@ public: ...@@ -276,8 +276,8 @@ public:
// others // others
void SetPadName( const wxString& name ); // Change pad name void SetPadName( const wxString& name ); // Change pad name
wxString ReturnStringPadName(); // Return pad name as string in a wxString wxString ReturnStringPadName() const; // Return pad name as string in a wxString
void ReturnStringPadName( wxString& text ); // Return pad name as string in a buffer void ReturnStringPadName( wxString& text ) const; // Return pad name as string in a buffer
void ComputeShapeMaxRadius(); // compute radius void ComputeShapeMaxRadius(); // compute radius
int GetMaxRadius() const; int GetMaxRadius() const;
...@@ -357,6 +357,8 @@ public: ...@@ -357,6 +357,8 @@ public:
} }
virtual wxString GetSelectMenuText() const;
#if defined(DEBUG) #if defined(DEBUG)
/** /**
......
...@@ -329,6 +329,23 @@ void TEXTE_PCB::Flip(const wxPoint& aCentre ) ...@@ -329,6 +329,23 @@ void TEXTE_PCB::Flip(const wxPoint& aCentre )
} }
wxString TEXTE_PCB::GetSelectMenuText() const
{
wxString text;
text << _( "Pcb Text" ) << wxT( " " );
if( m_Text.Len() < 12 )
text << m_Text;
else
text += m_Text.Left( 10 ) + wxT( ".." );
text << _( " on " ) << GetLayerName();
return text;
}
#if defined(DEBUG) #if defined(DEBUG)
/** /**
......
...@@ -124,12 +124,13 @@ public: ...@@ -124,12 +124,13 @@ public:
* clearance when the circle is approximated by segment bigger or equal * clearance when the circle is approximated by segment bigger or equal
* to the real clearance value (usually near from 1.0) * to the real clearance value (usually near from 1.0)
*/ */
void TransformShapeWithClearanceToPolygon( void TransformShapeWithClearanceToPolygon( std::vector <CPolyPt>& aCornerBuffer,
std::vector <CPolyPt>& aCornerBuffer,
int aClearanceValue, int aClearanceValue,
int aCircleToSegmentsCount, int aCircleToSegmentsCount,
double aCorrectionFactor ); double aCorrectionFactor );
virtual wxString GetSelectMenuText() const;
#if defined(DEBUG) #if defined(DEBUG)
/** /**
* Function Show * Function Show
......
...@@ -409,7 +409,7 @@ void TEXTE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const w ...@@ -409,7 +409,7 @@ void TEXTE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const w
size, m_HJustify, m_VJustify, width, m_Italic, m_Bold ); size, m_HJustify, m_VJustify, width, m_Italic, m_Bold );
} }
/* Rraws a line from the TEXTE_MODULE origin to parent MODULE origin. /* Draws a line from the TEXTE_MODULE origin to parent MODULE origin.
*/ */
void TEXTE_MODULE::DrawUmbilical( EDA_DRAW_PANEL* aPanel, void TEXTE_MODULE::DrawUmbilical( EDA_DRAW_PANEL* aPanel,
wxDC* aDC, wxDC* aDC,
...@@ -544,6 +544,31 @@ bool TEXTE_MODULE::IsOnLayer( int aLayer ) const ...@@ -544,6 +544,31 @@ bool TEXTE_MODULE::IsOnLayer( int aLayer ) const
*/ */
wxString TEXTE_MODULE::GetSelectMenuText() const
{
wxString text;
switch( m_Type )
{
case TEXT_is_REFERENCE:
text << _( "Reference" ) << wxT( " " ) << m_Text;
break;
case TEXT_is_VALUE:
text << _( "Value" ) << wxT( " " ) << m_Text << _( " of " )
<< ( (MODULE*) GetParent() )->GetReference();
break;
default: // wrap this one in quotes:
text << _( "Text" ) << wxT( " \"" ) << m_Text << wxT( "\"" ) << _( " of " )
<< ( (MODULE*) GetParent() )->GetReference();
break;
}
return text;
}
#if defined(DEBUG) #if defined(DEBUG)
/** /**
......
...@@ -159,6 +159,8 @@ public: TEXTE_MODULE( MODULE* parent, int text_type = TEXT_is_DIVERS ); ...@@ -159,6 +159,8 @@ public: TEXTE_MODULE( MODULE* parent, int text_type = TEXT_is_DIVERS );
} }
virtual wxString GetSelectMenuText() const;
#if defined(DEBUG) #if defined(DEBUG)
/** /**
......
...@@ -43,9 +43,7 @@ TRACK::TRACK( BOARD_ITEM* aParent, KICAD_T idtype ) : ...@@ -43,9 +43,7 @@ TRACK::TRACK( BOARD_ITEM* aParent, KICAD_T idtype ) :
} }
/***************************/ wxString TRACK::ShowWidth() const
wxString TRACK::ShowWidth()
/***************************/
{ {
wxString msg; wxString msg;
...@@ -61,12 +59,82 @@ SEGZONE::SEGZONE( BOARD_ITEM* aParent ) : ...@@ -61,12 +59,82 @@ SEGZONE::SEGZONE( BOARD_ITEM* aParent ) :
} }
wxString SEGZONE::GetSelectMenuText() const
{
wxString text;
NETINFO_ITEM* net;
BOARD* board = GetBoard();
text << _( "Zone" ) << wxT( " " ) << wxString::Format( wxT( "(%8.8X)" ), m_TimeStamp );
if( board )
{
net = board->FindNet( GetNet() );
if( net )
text << wxT( " [" ) << net->GetNetname() << wxT( "]" );
}
else
{
text << _( "** BOARD NOT DEFINED **" );
}
text << _( " on " ) << GetLayerName();
return text;
}
SEGVIA::SEGVIA( BOARD_ITEM* aParent ) : SEGVIA::SEGVIA( BOARD_ITEM* aParent ) :
TRACK( aParent, TYPE_VIA ) TRACK( aParent, TYPE_VIA )
{ {
} }
wxString SEGVIA::GetSelectMenuText() const
{
wxString text;
NETINFO_ITEM* net;
BOARD* board = GetBoard();
text << _( "Via" ) << wxT( " " ) << ShowWidth();
int shape = Shape();
if( shape == VIA_BLIND_BURIED )
text << wxT( " " ) << _( "Blind/Buried" );
else if( shape == VIA_MICROVIA )
text << wxT( " " ) << _( "Micro Via" );
// else say nothing about normal (through) vias
if( board )
{
net = board->FindNet( GetNet() );
if( net )
text << wxT( " [" ) << net->GetNetname() << wxT( "]" );
text << wxChar( ' ' ) << _( "Net:" ) << GetNet();
if( shape != VIA_THROUGH )
{
// say which layers, only two for now
int topLayer;
int botLayer;
ReturnLayerPair( &topLayer, &botLayer );
text << _( " on " ) << board->GetLayerName( topLayer ).Trim() << wxT( " <-> " )
<< board->GetLayerName( botLayer ).Trim();
}
}
else
{
text << _( "** BOARD NOT DEFINED **" );
}
return text;
}
// Copy constructor // Copy constructor
TRACK::TRACK( const TRACK& Source ) : TRACK::TRACK( const TRACK& Source ) :
BOARD_CONNECTED_ITEM( Source ) BOARD_CONNECTED_ITEM( Source )
...@@ -1131,6 +1199,36 @@ bool TRACK::HitTest( EDA_RECT& refArea ) ...@@ -1131,6 +1199,36 @@ bool TRACK::HitTest( EDA_RECT& refArea )
} }
wxString TRACK::GetSelectMenuText() const
{
wxString text;
wxString temp;
NETINFO_ITEM* net;
BOARD* board = GetBoard();
// deleting tracks requires all the information we can get to
// disambiguate all the choices under the cursor!
text << _( "Track" ) << wxT( " " ) << ShowWidth();
if( board )
{
net = board->FindNet( GetNet() );
if( net )
text << wxT( " [" ) << net->GetNetname() << wxT( "]" );
}
else
{
text << _( "** BOARD NOT DEFINED ** " );
}
text << _( " on " ) << GetLayerName() << wxT(" ") << _("Net:") << GetNet()
<< wxT(" ") << _("Length:") << valeur_param( GetLength(), temp );
return text;
}
#if defined(DEBUG) #if defined(DEBUG)
/** /**
......
...@@ -9,10 +9,10 @@ ...@@ -9,10 +9,10 @@
#include "PolyLine.h" #include "PolyLine.h"
// Via attributes (m_Shape parmeter) // Via attributes (m_Shape parameter)
#define VIA_THROUGH 3 /* Always a through hole via */ #define VIA_THROUGH 3 /* Always a through hole via */
#define VIA_BLIND_BURIED 2 /* this via can be on internal layers */ #define VIA_BLIND_BURIED 2 /* this via can be on internal layers */
#define VIA_MICROVIA 1 /* this via which connect from an external layer to the near neightbour internal layer */ #define VIA_MICROVIA 1 /* this via which connect from an external layer to the near neighbor internal layer */
#define VIA_NOT_DEFINED 0 /* not yet used */ #define VIA_NOT_DEFINED 0 /* not yet used */
/***/ /***/
...@@ -52,7 +52,7 @@ public: ...@@ -52,7 +52,7 @@ public:
* will copy this object whether it is a TRACK or a SEGVIA returning * will copy this object whether it is a TRACK or a SEGVIA returning
* the corresponding type. * the corresponding type.
* @return - TRACK*, SEGVIA*, or SEGZONE*, declared as the least common * @return - TRACK*, SEGVIA*, or SEGZONE*, declared as the least common
* demoninator: TRACK * denominator: TRACK
*/ */
TRACK* Copy() const; TRACK* Copy() const;
...@@ -156,7 +156,7 @@ public: ...@@ -156,7 +156,7 @@ public:
* @param aClearanceValue = the clearance around the pad * @param aClearanceValue = the clearance around the pad
* @param aCircleToSegmentsCount = the number of segments to approximate a circle * @param aCircleToSegmentsCount = the number of segments to approximate a circle
* @param aCorrectionFactor = the correction to apply to circles radius to keep * @param aCorrectionFactor = the correction to apply to circles radius to keep
* clearance when the circle is approxiamted by segment bigger or equal * clearance when the circle is approximated by segment bigger or equal
* to the real clearance value (usually near from 1.0) * to the real clearance value (usually near from 1.0)
*/ */
void TransformShapeWithClearanceToPolygon( std::vector <CPolyPt>& aCornerBuffer, void TransformShapeWithClearanceToPolygon( std::vector <CPolyPt>& aCornerBuffer,
...@@ -228,7 +228,7 @@ public: ...@@ -228,7 +228,7 @@ public:
* Function ShowWidth * Function ShowWidth
* returns the width of the track in displayable user units. * returns the width of the track in displayable user units.
*/ */
wxString ShowWidth(); wxString ShowWidth() const;
/** /**
* Function Visit * Function Visit
...@@ -285,6 +285,7 @@ public: ...@@ -285,6 +285,7 @@ public:
*/ */
virtual int GetClearance( BOARD_CONNECTED_ITEM* aItem = NULL ) const; virtual int GetClearance( BOARD_CONNECTED_ITEM* aItem = NULL ) const;
virtual wxString GetSelectMenuText() const;
#if defined (DEBUG) #if defined (DEBUG)
...@@ -326,6 +327,9 @@ public: ...@@ -326,6 +327,9 @@ public:
SEGZONE* Next() const { return (SEGZONE*) Pnext; } SEGZONE* Next() const { return (SEGZONE*) Pnext; }
virtual wxString GetSelectMenuText() const;
}; };
...@@ -380,6 +384,8 @@ public: ...@@ -380,6 +384,8 @@ public:
} }
virtual wxString GetSelectMenuText() const;
#if defined (DEBUG) #if defined (DEBUG)
/** /**
......
...@@ -113,12 +113,12 @@ bool ZONE_CONTAINER::Save( FILE* aFile ) const ...@@ -113,12 +113,12 @@ bool ZONE_CONTAINER::Save( FILE* aFile ) const
if( ret < 3 ) if( ret < 3 )
return false; return false;
// Save the ouline layer info // Save the outline layer info
ret = fprintf( aFile, "ZLayer %d\n", m_Layer ); ret = fprintf( aFile, "ZLayer %d\n", m_Layer );
if( ret < 1 ) if( ret < 1 )
return false; return false;
// Save the ouline aux info // Save the outline aux info
switch( m_Poly->GetHatchStyle() ) switch( m_Poly->GetHatchStyle() )
{ {
default: default:
...@@ -364,7 +364,7 @@ int ZONE_CONTAINER::ReadDescr( LINE_READER* aReader ) ...@@ -364,7 +364,7 @@ int ZONE_CONTAINER::ReadDescr( LINE_READER* aReader )
m_IsFilled = (fillstate == 'S') ? true : false; m_IsFilled = (fillstate == 'S') ? true : false;
} }
else if( strnicmp( Line, "ZClearance", 10 ) == 0 ) // Clearence and pad options info found else if( strnicmp( Line, "ZClearance", 10 ) == 0 ) // Clearance and pad options info found
{ {
int clearance = 200; int clearance = 200;
char padoption; char padoption;
...@@ -622,11 +622,11 @@ void ZONE_CONTAINER::DrawFilledArea( EDA_DRAW_PANEL* panel, ...@@ -622,11 +622,11 @@ void ZONE_CONTAINER::DrawFilledArea( EDA_DRAW_PANEL* panel,
if( (corner->end_contour) || (ic == imax) ) // the last corner of a filled area is found: draw it if( (corner->end_contour) || (ic == imax) ) // the last corner of a filled area is found: draw it
{ {
/* Draw the current filled area: draw segments ouline first /* Draw the current filled area: draw segments outline first
* Curiously, draw segments ouline first and after draw filled polygons * Curiously, draw segments outline first and after draw filled polygons
* with oulines thickness = 0 is a faster than * with outlines thickness = 0 is a faster than
* just draw filled polygons but with oulines thickness = m_ZoneMinThickness * just draw filled polygons but with outlines thickness = m_ZoneMinThickness
* So DO NOT use draw filled polygons with oulines having a thickness > 0 * So DO NOT use draw filled polygons with outlines having a thickness > 0
* Note: Extra segments ( added by kbool to joint holes with external outline) are not drawn * Note: Extra segments ( added by kbool to joint holes with external outline) are not drawn
*/ */
{ {
...@@ -719,7 +719,7 @@ void ZONE_CONTAINER::DrawWhileCreateOutline( EDA_DRAW_PANEL* panel, wxDC* DC, in ...@@ -719,7 +719,7 @@ void ZONE_CONTAINER::DrawWhileCreateOutline( EDA_DRAW_PANEL* panel, wxDC* DC, in
* Draws the zone outline when ir is created. * Draws the zone outline when ir is created.
* The moving edges (last segment and the closing edge segment) are in XOR graphic mode, * The moving edges (last segment and the closing edge segment) are in XOR graphic mode,
* old segment in OR graphic mode * old segment in OR graphic mode
* The closing edge has its owm shape * The closing edge has its own shape
* @param panel = current Draw Panel * @param panel = current Draw Panel
* @param DC = current Device Context * @param DC = current Device Context
* @param draw_mode = draw mode: OR, XOR .. * @param draw_mode = draw mode: OR, XOR ..
...@@ -762,7 +762,7 @@ void ZONE_CONTAINER::DrawWhileCreateOutline( EDA_DRAW_PANEL* panel, wxDC* DC, in ...@@ -762,7 +762,7 @@ void ZONE_CONTAINER::DrawWhileCreateOutline( EDA_DRAW_PANEL* panel, wxDC* DC, in
else else
current_gr_mode = draw_mode; current_gr_mode = draw_mode;
} }
else // Draw the line from last corner to the first corner of the current coutour else // Draw the line from last corner to the first corner of the current contour
{ {
is_close_segment = true; is_close_segment = true;
current_gr_mode = GR_XOR; current_gr_mode = GR_XOR;
...@@ -947,7 +947,7 @@ bool ZONE_CONTAINER::HitTestFilledArea( const wxPoint& aRefPos ) ...@@ -947,7 +947,7 @@ bool ZONE_CONTAINER::HitTestFilledArea( const wxPoint& aRefPos )
break; break;
} }
// Prepare test of next area which starts after the current indexend (if exists) // Prepare test of next area which starts after the current index end (if exists)
indexstart = indexend + 1; indexstart = indexend + 1;
} }
} }
...@@ -997,7 +997,7 @@ void ZONE_CONTAINER::DisplayInfo( EDA_DRAW_FRAME* frame ) ...@@ -997,7 +997,7 @@ void ZONE_CONTAINER::DisplayInfo( EDA_DRAW_FRAME* frame )
else else
frame->AppendMsgPanel( _( "Non Copper Zone" ), wxEmptyString, RED ); frame->AppendMsgPanel( _( "Non Copper Zone" ), wxEmptyString, RED );
/* Display net code : (usefull in test or debug) */ /* Display net code : (useful in test or debug) */
msg.Printf( wxT( "%d" ), GetNet() ); msg.Printf( wxT( "%d" ), GetNet() );
frame->AppendMsgPanel( _( "NetCode" ), msg, RED ); frame->AppendMsgPanel( _( "NetCode" ), msg, RED );
...@@ -1176,7 +1176,7 @@ void ZONE_CONTAINER::Mirror( const wxPoint& mirror_ref ) ...@@ -1176,7 +1176,7 @@ void ZONE_CONTAINER::Mirror( const wxPoint& mirror_ref )
/** /**
* Function copy * Function copy
* copy usefull data from the source. * copy useful data from the source.
* flags and linked list pointers are NOT copied * flags and linked list pointers are NOT copied
*/ */
void ZONE_CONTAINER::Copy( ZONE_CONTAINER* src ) void ZONE_CONTAINER::Copy( ZONE_CONTAINER* src )
...@@ -1221,3 +1221,51 @@ bool ZONE_CONTAINER::SetNetNameFromNetCode( void ) ...@@ -1221,3 +1221,51 @@ bool ZONE_CONTAINER::SetNetNameFromNetCode( void )
return false; return false;
} }
wxString ZONE_CONTAINER::GetSelectMenuText() const
{
wxString text;
NETINFO_ITEM* net;
BOARD* board = GetBoard();
text = _( "Zone Outline" );
int ncont = m_Poly->GetContour( m_CornerSelection );
if( ncont )
text << wxT( " " ) << _( "(Cutout)" );
text << wxT( " " );
text << wxString::Format( wxT( "(%8.8X)" ), m_TimeStamp );
if ( !IsOnCopperLayer() )
{
text << wxT( " [" ) << _( "Not on copper layer" ) << wxT( "]" );
}
else if( GetNet() >= 0 )
{
if( board )
{
net = board->FindNet( GetNet() );
if( net )
{
text << wxT( " [" ) << net->GetNetname() << wxT( "]" );
}
}
else
{
text << _( "** NO BOARD DEFINED **" );
}
}
else // A netcode < 0 is an error flag (Netname not found or area not initialised)
{
text << wxT( " [" ) << m_Netname << wxT( "]" );
text << wxT( " <" ) << _( "Not Found" ) << wxT( ">" );
}
text << _( " on " ) << GetLayerName();
return text;
}
...@@ -47,8 +47,8 @@ public: ...@@ -47,8 +47,8 @@ public:
int m_ArcToSegmentsCount; // number of segments to convert a circle to a polygon int m_ArcToSegmentsCount; // number of segments to convert a circle to a polygon
// (uses ARC_APPROX_SEGMENTS_COUNT_LOW_DEF or ARC_APPROX_SEGMENTS_COUNT_HIGHT_DEF) // (uses ARC_APPROX_SEGMENTS_COUNT_LOW_DEF or ARC_APPROX_SEGMENTS_COUNT_HIGHT_DEF)
int m_PadOption; // int m_PadOption; //
int m_ThermalReliefGapValue; // tickness of the gap in thermal reliefs int m_ThermalReliefGapValue; // thickness of the gap in thermal reliefs
int m_ThermalReliefCopperBridgeValue; // tickness of the copper bridge in thermal reliefs int m_ThermalReliefCopperBridgeValue; // thickness of the copper bridge in thermal reliefs
int utility, utility2; // flags used in polygon calculations int utility, utility2; // flags used in polygon calculations
bool m_IsFilled; // true when a zone was filled, false after deleting the filled areas bool m_IsFilled; // true when a zone was filled, false after deleting the filled areas
std::vector <CPolyPt> m_FilledPolysList; /* set of filled polygons used to draw a zone as a filled area. std::vector <CPolyPt> m_FilledPolysList; /* set of filled polygons used to draw a zone as a filled area.
...@@ -56,7 +56,7 @@ public: ...@@ -56,7 +56,7 @@ public:
* In very simple cases m_FilledPolysList is same as m_Poly * In very simple cases m_FilledPolysList is same as m_Poly
* In less simple cases (when m_Poly has holes) m_FilledPolysList is a polygon equivalent to m_Poly, without holes * In less simple cases (when m_Poly has holes) m_FilledPolysList is a polygon equivalent to m_Poly, without holes
* but with extra outline segment connecting "holes" with external main outline * but with extra outline segment connecting "holes" with external main outline
* In complex cases an ouline decribed by m_Poly can have many filled areas * In complex cases an outline described by m_Poly can have many filled areas
*/ */
std::vector <SEGMENT> m_FillSegmList; /* set of segments used to fill area, when fill zone by segment is used. std::vector <SEGMENT> m_FillSegmList; /* set of segments used to fill area, when fill zone by segment is used.
* ( m_FillMode == 1 ) * ( m_FillMode == 1 )
...@@ -88,7 +88,7 @@ public: ...@@ -88,7 +88,7 @@ public:
/** /**
* Function copy * Function copy
* copy usefull data from the source. * copy useful data from the source.
* flags and linked list pointers are NOT copied * flags and linked list pointers are NOT copied
*/ */
void Copy( ZONE_CONTAINER* src ); void Copy( ZONE_CONTAINER* src );
...@@ -125,7 +125,7 @@ public: ...@@ -125,7 +125,7 @@ public:
* Function DrawWhileCreateOutline * Function DrawWhileCreateOutline
* Draws the zone outline when ir is created. * Draws the zone outline when ir is created.
* The moving edges are in XOR graphic mode, old segment in draw_mode graphic mode (usually GR_OR) * The moving edges are in XOR graphic mode, old segment in draw_mode graphic mode (usually GR_OR)
* The closing edge has its owm shape * The closing edge has its own shape
* @param panel = current Draw Panel * @param panel = current Draw Panel
* @param DC = current Device Context * @param DC = current Device Context
* @param draw_mode = draw mode: OR, XOR .. * @param draw_mode = draw mode: OR, XOR ..
...@@ -141,7 +141,7 @@ public: ...@@ -141,7 +141,7 @@ public:
/** /**
* Function Test_For_Copper_Island_And_Remove__Insulated_Islands * Function Test_For_Copper_Island_And_Remove__Insulated_Islands
* Remove insulated copper islands found in m_FilledPolysList. * Remove insulated copper islands found in m_FilledPolysList.
* @param aPcb = the board to analyse * @param aPcb = the board to analyze
*/ */
void Test_For_Copper_Island_And_Remove_Insulated_Islands( BOARD* aPcb ); void Test_For_Copper_Island_And_Remove_Insulated_Islands( BOARD* aPcb );
...@@ -159,7 +159,7 @@ public: ...@@ -159,7 +159,7 @@ public:
* Function IsOnCopperLayer * Function IsOnCopperLayer
* @return true if this zone is on a copper layer, false if on a technical layer * @return true if this zone is on a copper layer, false if on a technical layer
*/ */
bool IsOnCopperLayer( void ) bool IsOnCopperLayer( void ) const
{ {
return ( GetLayer() < FIRST_NO_COPPER_LAYER ) ? true : false; return ( GetLayer() < FIRST_NO_COPPER_LAYER ) ? true : false;
} }
...@@ -183,7 +183,7 @@ public: ...@@ -183,7 +183,7 @@ public:
/** /**
* Function HitTest * Function HitTest
* tests if the given wxPoint is within the bounds of this object. * tests if the given wxPoint is within the bounds of this object.
* For zones, this means near an ouline segment * For zones, this means near an outline segment
* @param refPos A wxPoint to test * @param refPos A wxPoint to test
* @return bool - true if a hit, else false * @return bool - true if a hit, else false
*/ */
...@@ -211,13 +211,13 @@ public: ...@@ -211,13 +211,13 @@ public:
/** /**
* Function AddClearanceAreasPolygonsToPolysList * Function AddClearanceAreasPolygonsToPolysList
* Add non copper areas polygons (pads and tracks with clearence) * Add non copper areas polygons (pads and tracks with clearance)
* to a filled copper area * to a filled copper area
* used in BuildFilledPolysListData when calculating filled areas in a zone * used in BuildFilledPolysListData when calculating filled areas in a zone
* Non copper areas are pads and track and their clearance area * Non copper areas are pads and track and their clearance area
* The filled copper area must be computed before * The filled copper area must be computed before
* BuildFilledPolysListData() call this function just after creating the * BuildFilledPolysListData() call this function just after creating the
* filled copper area polygon (without clearence areas * filled copper area polygon (without clearance areas
* @param aPcb: the current board * @param aPcb: the current board
*/ */
void AddClearanceAreasPolygonsToPolysList( BOARD* aPcb ); void AddClearanceAreasPolygonsToPolysList( BOARD* aPcb );
...@@ -341,7 +341,7 @@ public: ...@@ -341,7 +341,7 @@ public:
} }
/** Acces to m_Poly parameters /** Access to m_Poly parameters
*/ */
int GetNumCorners( void ) const int GetNumCorners( void ) const
...@@ -417,6 +417,9 @@ public: ...@@ -417,6 +417,9 @@ public:
}; };
unsigned int GetCornerRadius() const { return cornerRadius; }; unsigned int GetCornerRadius() const { return cornerRadius; };
virtual wxString GetSelectMenuText() const;
}; };
......
...@@ -197,7 +197,7 @@ BOARD_ITEM* PCB_BASE_FRAME::PcbGeneralLocateAndDisplay( int aHotKeyCode ) ...@@ -197,7 +197,7 @@ BOARD_ITEM* PCB_BASE_FRAME::PcbGeneralLocateAndDisplay( int aHotKeyCode )
item = (*m_Collector)[i]; item = (*m_Collector)[i];
text = item->MenuText( m_Pcb ); text = item->GetSelectMenuText();
xpm = item->MenuIcon(); xpm = item->MenuIcon();
ADD_MENUITEM( &itemMenu, ID_POPUP_PCB_ITEM_SELECTION_START + i, text, xpm ); ADD_MENUITEM( &itemMenu, ID_POPUP_PCB_ITEM_SELECTION_START + i, text, xpm );
......
...@@ -483,7 +483,8 @@ void DRC::testUnconnected() ...@@ -483,7 +483,8 @@ void DRC::testUnconnected()
D_PAD* padEnd = rat->m_PadEnd; D_PAD* padEnd = rat->m_PadEnd;
DRC_ITEM* uncItem = new DRC_ITEM( DRCE_UNCONNECTED_PADS, DRC_ITEM* uncItem = new DRC_ITEM( DRCE_UNCONNECTED_PADS,
padStart->MenuText( m_pcb ), padEnd->MenuText( m_pcb ), padStart->GetSelectMenuText(),
padEnd->GetSelectMenuText(),
padStart->GetPosition(), padEnd->GetPosition() ); padStart->GetPosition(), padEnd->GetPosition() );
m_unconnected.push_back( uncItem ); m_unconnected.push_back( uncItem );
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
MARKER_PCB* DRC::fillMarker( TRACK* aTrack, BOARD_ITEM* aItem, int aErrorCode, MARKER_PCB* fillMe ) MARKER_PCB* DRC::fillMarker( TRACK* aTrack, BOARD_ITEM* aItem, int aErrorCode, MARKER_PCB* fillMe )
{ {
wxString textA = aTrack->MenuText( m_pcb ); wxString textA = aTrack->GetSelectMenuText();
wxString textB; wxString textB;
wxPoint position; wxPoint position;
...@@ -50,7 +50,7 @@ MARKER_PCB* DRC::fillMarker( TRACK* aTrack, BOARD_ITEM* aItem, int aErrorCode, M ...@@ -50,7 +50,7 @@ MARKER_PCB* DRC::fillMarker( TRACK* aTrack, BOARD_ITEM* aItem, int aErrorCode, M
if( aItem ) // aItem might be NULL if( aItem ) // aItem might be NULL
{ {
textB = aItem->MenuText( m_pcb ); textB = aItem->GetSelectMenuText();
posB = aItem->GetPosition(); posB = aItem->GetPosition();
if( aItem->Type() == TYPE_PAD ) if( aItem->Type() == TYPE_PAD )
...@@ -108,8 +108,8 @@ MARKER_PCB* DRC::fillMarker( TRACK* aTrack, BOARD_ITEM* aItem, int aErrorCode, M ...@@ -108,8 +108,8 @@ MARKER_PCB* DRC::fillMarker( TRACK* aTrack, BOARD_ITEM* aItem, int aErrorCode, M
MARKER_PCB* DRC::fillMarker( D_PAD* aPad, D_PAD* bPad, int aErrorCode, MARKER_PCB* fillMe ) MARKER_PCB* DRC::fillMarker( D_PAD* aPad, D_PAD* bPad, int aErrorCode, MARKER_PCB* fillMe )
{ {
wxString textA = aPad->MenuText( m_pcb ); wxString textA = aPad->GetSelectMenuText();
wxString textB = bPad->MenuText( m_pcb ); wxString textB = bPad->GetSelectMenuText();
wxPoint posA = aPad->GetPosition(); wxPoint posA = aPad->GetPosition();
wxPoint posB = bPad->GetPosition(); wxPoint posB = bPad->GetPosition();
...@@ -125,7 +125,7 @@ MARKER_PCB* DRC::fillMarker( D_PAD* aPad, D_PAD* bPad, int aErrorCode, MARKER_PC ...@@ -125,7 +125,7 @@ MARKER_PCB* DRC::fillMarker( D_PAD* aPad, D_PAD* bPad, int aErrorCode, MARKER_PC
MARKER_PCB* DRC::fillMarker( ZONE_CONTAINER* aArea, int aErrorCode, MARKER_PCB* fillMe ) MARKER_PCB* DRC::fillMarker( ZONE_CONTAINER* aArea, int aErrorCode, MARKER_PCB* fillMe )
{ {
wxString textA = aArea->MenuText( m_pcb ); wxString textA = aArea->GetSelectMenuText();
wxPoint posA = aArea->GetPosition(); wxPoint posA = aArea->GetPosition();
...@@ -143,7 +143,7 @@ MARKER_PCB* DRC::fillMarker( const ZONE_CONTAINER* aArea, ...@@ -143,7 +143,7 @@ MARKER_PCB* DRC::fillMarker( const ZONE_CONTAINER* aArea,
int aErrorCode, int aErrorCode,
MARKER_PCB* fillMe ) MARKER_PCB* fillMe )
{ {
wxString textA = aArea->MenuText( m_pcb ); wxString textA = aArea->GetSelectMenuText();
wxPoint posA = aPos; wxPoint posA = aPos;
......
...@@ -99,7 +99,7 @@ BOARD_ITEM* WinEDA_ModuleEditFrame::ModeditLocateAndDisplay( int aHotKeyCode ) ...@@ -99,7 +99,7 @@ BOARD_ITEM* WinEDA_ModuleEditFrame::ModeditLocateAndDisplay( int aHotKeyCode )
item = (*m_Collector)[ii]; item = (*m_Collector)[ii];
text = item->MenuText( GetBoard() ); text = item->GetSelectMenuText();
xpm = item->MenuIcon(); xpm = item->MenuIcon();
ADD_MENUITEM( &itemMenu, ADD_MENUITEM( &itemMenu,
......
...@@ -617,7 +617,7 @@ void PCB_EDIT_FRAME::createPopUpMenuForFootprints( MODULE* aModule, wxMenu* menu ...@@ -617,7 +617,7 @@ void PCB_EDIT_FRAME::createPopUpMenuForFootprints( MODULE* aModule, wxMenu* menu
sub_menu_footprint = new wxMenu; sub_menu_footprint = new wxMenu;
msg = aModule->MenuText( GetBoard() ); msg = aModule->GetSelectMenuText();
ADD_MENUITEM_WITH_SUBMENU( menu, sub_menu_footprint, -1, msg, module_xpm ); ADD_MENUITEM_WITH_SUBMENU( menu, sub_menu_footprint, -1, msg, module_xpm );
if( !flags ) if( !flags )
...@@ -657,7 +657,7 @@ void PCB_EDIT_FRAME::createPopUpMenuForFpTexts( TEXTE_MODULE* FpText, wxMenu* me ...@@ -657,7 +657,7 @@ void PCB_EDIT_FRAME::createPopUpMenuForFpTexts( TEXTE_MODULE* FpText, wxMenu* me
wxMenu* sub_menu_Fp_text; wxMenu* sub_menu_Fp_text;
int flags = FpText->m_Flags; int flags = FpText->m_Flags;
wxString msg = FpText->MenuText( GetBoard() ); wxString msg = FpText->GetSelectMenuText();
sub_menu_Fp_text = new wxMenu; sub_menu_Fp_text = new wxMenu;
...@@ -717,7 +717,7 @@ void PCB_EDIT_FRAME::createPopUpMenuForFpPads( D_PAD* Pad, wxMenu* menu ) ...@@ -717,7 +717,7 @@ void PCB_EDIT_FRAME::createPopUpMenuForFpPads( D_PAD* Pad, wxMenu* menu )
updateTraceWidthSelectBox(); updateTraceWidthSelectBox();
updateViaSizeSelectBox(); updateViaSizeSelectBox();
wxString msg = Pad->MenuText( GetBoard() ); wxString msg = Pad->GetSelectMenuText();
sub_menu_Pad = new wxMenu; sub_menu_Pad = new wxMenu;
ADD_MENUITEM_WITH_SUBMENU( menu, sub_menu_Pad, -1, msg, pad_xpm ); ADD_MENUITEM_WITH_SUBMENU( menu, sub_menu_Pad, -1, msg, pad_xpm );
...@@ -767,7 +767,7 @@ void PCB_EDIT_FRAME::createPopUpMenuForTexts( TEXTE_PCB* Text, wxMenu* menu ) ...@@ -767,7 +767,7 @@ void PCB_EDIT_FRAME::createPopUpMenuForTexts( TEXTE_PCB* Text, wxMenu* menu )
wxMenu* sub_menu_Text; wxMenu* sub_menu_Text;
int flags = Text->m_Flags; int flags = Text->m_Flags;
wxString msg = Text->MenuText( GetBoard() ); wxString msg = Text->GetSelectMenuText();
sub_menu_Text = new wxMenu; sub_menu_Text = new wxMenu;
......
...@@ -896,9 +896,10 @@ int BOARD::Test_Drc_Areas_Outlines_To_Areas_Outlines( ZONE_CONTAINER* aArea_To_E ...@@ -896,9 +896,10 @@ int BOARD::Test_Drc_Areas_Outlines_To_Areas_Outlines( ZONE_CONTAINER* aArea_To_E
// COPPERAREA_COPPERAREA error: copper area ref corner inside copper area // COPPERAREA_COPPERAREA error: copper area ref corner inside copper area
if( aCreate_Markers ) if( aCreate_Markers )
{ {
wxString msg1 = Area_Ref->MenuText( this ); wxString msg1 = Area_Ref->GetSelectMenuText();
wxString msg2 = Area_To_Test->MenuText( this ); wxString msg2 = Area_To_Test->GetSelectMenuText();
MARKER_PCB* marker = new MARKER_PCB( COPPERAREA_INSIDE_COPPERAREA, wxPoint( x, y ), MARKER_PCB* marker = new MARKER_PCB( COPPERAREA_INSIDE_COPPERAREA,
wxPoint( x, y ),
msg1, wxPoint( x, y ), msg1, wxPoint( x, y ),
msg2, wxPoint( x, y ) ); msg2, wxPoint( x, y ) );
Add( marker ); Add( marker );
...@@ -917,9 +918,10 @@ int BOARD::Test_Drc_Areas_Outlines_To_Areas_Outlines( ZONE_CONTAINER* aArea_To_E ...@@ -917,9 +918,10 @@ int BOARD::Test_Drc_Areas_Outlines_To_Areas_Outlines( ZONE_CONTAINER* aArea_To_E
// COPPERAREA_COPPERAREA error: copper area corner inside copper area ref // COPPERAREA_COPPERAREA error: copper area corner inside copper area ref
if( aCreate_Markers ) if( aCreate_Markers )
{ {
wxString msg1 = Area_To_Test->MenuText( this ); wxString msg1 = Area_To_Test->GetSelectMenuText();
wxString msg2 = Area_Ref->MenuText( this ); wxString msg2 = Area_Ref->GetSelectMenuText();
MARKER_PCB* marker = new MARKER_PCB( COPPERAREA_INSIDE_COPPERAREA, wxPoint( x, y ), MARKER_PCB* marker = new MARKER_PCB( COPPERAREA_INSIDE_COPPERAREA,
wxPoint( x, y ),
msg1, wxPoint( x, y ), msg1, wxPoint( x, y ),
msg2, wxPoint( x, y ) ); msg2, wxPoint( x, y ) );
Add( marker ); Add( marker );
...@@ -985,8 +987,8 @@ int BOARD::Test_Drc_Areas_Outlines_To_Areas_Outlines( ZONE_CONTAINER* aArea_To_E ...@@ -985,8 +987,8 @@ int BOARD::Test_Drc_Areas_Outlines_To_Areas_Outlines( ZONE_CONTAINER* aArea_To_E
// COPPERAREA_COPPERAREA error : intersect or too close // COPPERAREA_COPPERAREA error : intersect or too close
if( aCreate_Markers ) if( aCreate_Markers )
{ {
wxString msg1 = Area_Ref->MenuText( this ); wxString msg1 = Area_Ref->GetSelectMenuText();
wxString msg2 = Area_To_Test->MenuText( this ); wxString msg2 = Area_To_Test->GetSelectMenuText();
MARKER_PCB* marker = new MARKER_PCB( COPPERAREA_CLOSE_TO_COPPERAREA, MARKER_PCB* marker = new MARKER_PCB( COPPERAREA_CLOSE_TO_COPPERAREA,
wxPoint( x, y ), wxPoint( x, y ),
msg1, wxPoint( x, y ), msg1, wxPoint( x, y ),
......
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