Added selection box for modules.

This commit is contained in:
Maciej Suminski 2013-08-08 11:53:29 +02:00
parent 16437e5d45
commit cc5c038362
4 changed files with 29 additions and 0 deletions

View File

@ -1024,3 +1024,9 @@ void MODULE::SetOrientation( double newangle )
CalculateBoundingBox();
}
void MODULE::ViewGetLayers( int aLayers[], int& aCount ) const
{
aCount = 1;
aLayers[0] = ITEM_GAL_LAYER( GP_OVERLAY ); // Selection box
}

View File

@ -497,6 +497,9 @@ public:
/// Return the initial comments block or NULL if none, without transfer of ownership.
const wxArrayString* GetInitialComments() const { return m_initial_comments; }
/// @copydoc VIEW_ITEM::ViewGetLayers()
virtual void ViewGetLayers( int aLayers[], int& aCount ) const;
#if defined(DEBUG)
virtual void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override
#endif

View File

@ -219,6 +219,10 @@ bool PCB_PAINTER::Draw( const VIEW_ITEM* aItem, int aLayer )
draw( (DRAWSEGMENT*) aItem );
break;
case PCB_MODULE_T:
draw( (MODULE*) aItem );
break;
case PCB_TEXT_T:
draw( (TEXTE_PCB*) aItem );
break;
@ -654,6 +658,21 @@ void PCB_PAINTER::draw( const DRAWSEGMENT* aSegment )
}
void PCB_PAINTER::draw( const MODULE* aModule )
{
// For modules we have to draw a selection box if needed
if( aModule->IsSelected() )
{
BOX2I boundingBox = aModule->ViewBBox();
m_gal->SetIsStroke( false );
m_gal->SetIsFill( true );
m_gal->SetFillColor( COLOR4D( 1.0, 1.0, 1.0, 0.5 ) );
m_gal->DrawRectangle( boundingBox.GetOrigin(), boundingBox.GetEnd() );
}
}
void PCB_PAINTER::draw( const TEXTE_PCB* aText )
{
if( aText->GetText().Length() == 0 )

View File

@ -141,6 +141,7 @@ protected:
void draw( const SEGVIA*, int );
void draw( const D_PAD*, int );
void draw( const DRAWSEGMENT* );
void draw( const MODULE* );
void draw( const TEXTE_PCB* );
void draw( const TEXTE_MODULE*, int );
void draw( const ZONE_CONTAINER* );