diff --git a/pcbnew/class_module.cpp b/pcbnew/class_module.cpp index f5b29906a6..cf61f31493 100644 --- a/pcbnew/class_module.cpp +++ b/pcbnew/class_module.cpp @@ -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 +} diff --git a/pcbnew/class_module.h b/pcbnew/class_module.h index 9730bd7caf..2ab09071fa 100644 --- a/pcbnew/class_module.h +++ b/pcbnew/class_module.h @@ -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 diff --git a/pcbnew/pcb_painter.cpp b/pcbnew/pcb_painter.cpp index 49260064bc..6143e24219 100644 --- a/pcbnew/pcb_painter.cpp +++ b/pcbnew/pcb_painter.cpp @@ -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 ) diff --git a/pcbnew/pcb_painter.h b/pcbnew/pcb_painter.h index 250e291413..3c220ee164 100644 --- a/pcbnew/pcb_painter.h +++ b/pcbnew/pcb_painter.h @@ -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* );