Commit cc5c0383 authored by Maciej Suminski's avatar Maciej Suminski

Added selection box for modules.

parent 16437e5d
......@@ -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
}
......@@ -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
......
......@@ -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 )
......
......@@ -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* );
......
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