From 476ec04b1328626dc1a59f001a35a6d75594d163 Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Tue, 25 Feb 2014 18:08:33 +0100 Subject: [PATCH] Minor changes to BRIGHT_BOX class. --- pcbnew/tools/bright_box.cpp | 27 +++++++-------------------- pcbnew/tools/bright_box.h | 19 +++++++++++++------ 2 files changed, 20 insertions(+), 26 deletions(-) diff --git a/pcbnew/tools/bright_box.cpp b/pcbnew/tools/bright_box.cpp index b0fd4aec81..689b6169b5 100644 --- a/pcbnew/tools/bright_box.cpp +++ b/pcbnew/tools/bright_box.cpp @@ -30,44 +30,31 @@ using namespace KIGFX; BRIGHT_BOX::BRIGHT_BOX( BOARD_ITEM* aItem ) : EDA_ITEM( NOT_USED ), // this item is never added to a BOARD so it needs no type - item( aItem ) + m_item( aItem ) { } -const BOX2I BRIGHT_BOX::ViewBBox() const -{ - return item->ViewBBox(); -} - - -void BRIGHT_BOX::ViewGetLayers( int aLayers[], int& aCount ) const -{ - aLayers[0] = BrightBoxLayer; - aCount = 1; -} - - void BRIGHT_BOX::ViewDraw( int aLayer, GAL* aGal ) const { aGal->SetIsStroke( true ); aGal->SetIsFill( false ); - aGal->SetLineWidth( LineWidth ); - aGal->SetStrokeColor( BrightColor ); + aGal->SetLineWidth( LINE_WIDTH ); + aGal->SetStrokeColor( BOX_COLOR ); - if( item->Type() == PCB_TRACE_T ) + if( m_item->Type() == PCB_TRACE_T ) { - const TRACK* track = static_cast( item ); + const TRACK* track = static_cast( m_item ); aGal->DrawSegment( track->GetStart(), track->GetEnd(), track->GetWidth() ); } else { - BOX2I box = item->ViewBBox(); + BOX2I box = m_item->ViewBBox(); aGal->DrawRectangle( box.GetOrigin(), box.GetOrigin() + box.GetSize() ); } } -const COLOR4D BRIGHT_BOX::BrightColor = KIGFX::COLOR4D( 0.0, 1.0, 0.0, 1.0 ); +const COLOR4D BRIGHT_BOX::BOX_COLOR = KIGFX::COLOR4D( 0.0, 1.0, 0.0, 1.0 ); diff --git a/pcbnew/tools/bright_box.h b/pcbnew/tools/bright_box.h index 14966db9ac..8a6a583335 100644 --- a/pcbnew/tools/bright_box.h +++ b/pcbnew/tools/bright_box.h @@ -42,21 +42,28 @@ public: BRIGHT_BOX( BOARD_ITEM* aItem ); ~BRIGHT_BOX() {}; - virtual const BOX2I ViewBBox() const; + virtual const BOX2I ViewBBox() const + { + return m_item->ViewBBox(); + } void ViewDraw( int aLayer, KIGFX::GAL* aGal ) const; - void ViewGetLayers( int aLayers[], int& aCount ) const; + + void ViewGetLayers( int aLayers[], int& aCount ) const + { + aLayers[0] = ITEM_GAL_LAYER( GP_OVERLAY ); + aCount = 1; + } void Show( int x, std::ostream& st ) const { } private: - static const int BrightBoxLayer = ITEM_GAL_LAYER( GP_OVERLAY ); - static const KIGFX::COLOR4D BrightColor; - static const double LineWidth = 100000.0; + static const KIGFX::COLOR4D BOX_COLOR; + static const double LINE_WIDTH = 100000.0; - BOARD_ITEM* item; + BOARD_ITEM* m_item; }; #endif