From eeeffd1ad121716653c79ebfca989f0285e8dade Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Wed, 2 Oct 2013 11:39:08 +0200 Subject: [PATCH] Removed SELECTION layer. --- include/layers_id_colors_and_visibility.h | 1 - pcbnew/basepcbframe.cpp | 3 +- pcbnew/class_dimension.cpp | 12 -- pcbnew/class_dimension.h | 3 - pcbnew/class_module.cpp | 7 -- pcbnew/class_module.h | 3 - pcbnew/class_pcb_text.cpp | 11 -- pcbnew/class_pcb_text.h | 3 - pcbnew/class_text_mod.cpp | 5 +- pcbnew/pcb_painter.cpp | 132 +++++++--------------- pcbnew/pcb_painter.h | 4 - pcbnew/pcbframe.cpp | 4 +- pcbnew/tools/bright_box.h | 2 +- 13 files changed, 45 insertions(+), 145 deletions(-) diff --git a/include/layers_id_colors_and_visibility.h b/include/layers_id_colors_and_visibility.h index 71a3309dbc..49b0b03508 100644 --- a/include/layers_id_colors_and_visibility.h +++ b/include/layers_id_colors_and_visibility.h @@ -261,7 +261,6 @@ enum PCB_VISIBLE PAD_BK_NETNAMES_VISIBLE, PADS_NETNAMES_VISIBLE, - SELECTION, WORKSHEET, GP_OVERLAY, // General purpose overlay diff --git a/pcbnew/basepcbframe.cpp b/pcbnew/basepcbframe.cpp index 63e3636314..c41f2cf618 100644 --- a/pcbnew/basepcbframe.cpp +++ b/pcbnew/basepcbframe.cpp @@ -72,7 +72,7 @@ static const wxString FastGrid2Entry( wxT( "FastGrid2" ) ); const LAYER_NUM PCB_BASE_FRAME::GAL_LAYER_ORDER[] = { - ITEM_GAL_LAYER( GP_OVERLAY ), ITEM_GAL_LAYER( SELECTION ), + ITEM_GAL_LAYER( GP_OVERLAY ), ITEM_GAL_LAYER( PADS_NETNAMES_VISIBLE ), DRAW_N, COMMENT_N, ECO1_N, ECO2_N, EDGE_N, UNUSED_LAYER_29, UNUSED_LAYER_30, UNUSED_LAYER_31, @@ -895,7 +895,6 @@ void PCB_BASE_FRAME::LoadSettings() view->SetRequired( SOLDERPASTE_N_BACK, ITEM_GAL_LAYER( PAD_BK_VISIBLE ) ); view->SetRequired( SOLDERMASK_N_BACK, ITEM_GAL_LAYER( PAD_BK_VISIBLE ) ); - view->SetLayerTarget( ITEM_GAL_LAYER( SELECTION ), KiGfx::TARGET_OVERLAY ); view->SetLayerTarget( ITEM_GAL_LAYER( GP_OVERLAY ), KiGfx::TARGET_OVERLAY ); // Apply layer coloring scheme & display options diff --git a/pcbnew/class_dimension.cpp b/pcbnew/class_dimension.cpp index f7dacdc2a6..da5b9d9201 100644 --- a/pcbnew/class_dimension.cpp +++ b/pcbnew/class_dimension.cpp @@ -508,18 +508,6 @@ const BOX2I DIMENSION::ViewBBox() const } -void DIMENSION::ViewGetLayers( int aLayers[], int& aCount ) const -{ - // Layer that simply displays the text - aLayers[0] = m_Layer; - - // On the general purpose overlay there is a selection box displayed - aLayers[1] = ITEM_GAL_LAYER( SELECTION ); - - aCount = 2; -} - - EDA_ITEM* DIMENSION::Clone() const { return new DIMENSION( *this ); diff --git a/pcbnew/class_dimension.h b/pcbnew/class_dimension.h index 25baeca80f..efb5a28d3f 100644 --- a/pcbnew/class_dimension.h +++ b/pcbnew/class_dimension.h @@ -147,9 +147,6 @@ public: /// @copydoc VIEW_ITEM::ViewBBox() virtual const BOX2I ViewBBox() const; - /// @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/class_module.cpp b/pcbnew/class_module.cpp index 16ec8401d5..aef466c887 100644 --- a/pcbnew/class_module.cpp +++ b/pcbnew/class_module.cpp @@ -1024,10 +1024,3 @@ void MODULE::SetOrientation( double newangle ) CalculateBoundingBox(); } - -void MODULE::ViewGetLayers( int aLayers[], int& aCount ) const -{ - aCount = 2; - aLayers[0] = ITEM_GAL_LAYER( SELECTION ); // Selection box - aLayers[1] = m_Layer; -} diff --git a/pcbnew/class_module.h b/pcbnew/class_module.h index 1ea961ec37..ad83e94f8c 100644 --- a/pcbnew/class_module.h +++ b/pcbnew/class_module.h @@ -499,9 +499,6 @@ 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/class_pcb_text.cpp b/pcbnew/class_pcb_text.cpp index 15920fa968..ac14a42e05 100644 --- a/pcbnew/class_pcb_text.cpp +++ b/pcbnew/class_pcb_text.cpp @@ -224,14 +224,3 @@ const BOX2I TEXTE_PCB::ViewBBox() const } } - -void TEXTE_PCB::ViewGetLayers( int aLayers[], int& aCount ) const -{ - // Layer that simply displays the text - aLayers[0] = m_Layer; - - // On the general purpose overlay there is a selection box displayed - aLayers[1] = ITEM_GAL_LAYER( SELECTION ); - - aCount = 2; -} diff --git a/pcbnew/class_pcb_text.h b/pcbnew/class_pcb_text.h index d8896d7ea9..e577489be9 100644 --- a/pcbnew/class_pcb_text.h +++ b/pcbnew/class_pcb_text.h @@ -134,9 +134,6 @@ public: /// @copydoc VIEW_ITEM::ViewBBox() virtual const BOX2I ViewBBox() const; - /// @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/class_text_mod.cpp b/pcbnew/class_text_mod.cpp index e4f28f31b1..31b6a4d595 100644 --- a/pcbnew/class_text_mod.cpp +++ b/pcbnew/class_text_mod.cpp @@ -472,8 +472,5 @@ void TEXTE_MODULE::ViewGetLayers( int aLayers[], int& aCount ) const break; } - // On the general purpose overlay there is a selection box displayed - aLayers[1] = ITEM_GAL_LAYER( SELECTION ); - - aCount = 2; + aCount = 1; } diff --git a/pcbnew/pcb_painter.cpp b/pcbnew/pcb_painter.cpp index a0c29c5602..d721cc1a05 100644 --- a/pcbnew/pcb_painter.cpp +++ b/pcbnew/pcb_painter.cpp @@ -76,7 +76,6 @@ void PCB_RENDER_SETTINGS::ImportLegacyColors( COLORS_DESIGN_SETTINGS* aSettings m_layerColors[ITEM_GAL_LAYER( PAD_FR_NETNAMES_VISIBLE )] = COLOR4D( 0.8, 0.8, 0.8, 0.7 ); m_layerColors[ITEM_GAL_LAYER( PAD_BK_NETNAMES_VISIBLE )] = COLOR4D( 0.8, 0.8, 0.8, 0.7 ); m_layerColors[ITEM_GAL_LAYER( WORKSHEET )] = COLOR4D( 0.5, 0.0, 0.0, 1.0 ); - m_layerColors[ITEM_GAL_LAYER( SELECTION )] = COLOR4D( 1.0, 1.0, 1.0, 0.5 ); // Netnames for copper layers for( LAYER_NUM layer = FIRST_COPPER_LAYER; layer <= LAST_COPPER_LAYER; ++layer ) @@ -227,10 +226,6 @@ bool PCB_PAINTER::Draw( const VIEW_ITEM* aItem, int aLayer ) draw( (DRAWSEGMENT*) aItem ); break; - case PCB_MODULE_T: - draw( (MODULE*) aItem, aLayer ); - break; - case PCB_TEXT_T: draw( (TEXTE_PCB*) aItem, aLayer ); break; @@ -699,63 +694,35 @@ void PCB_PAINTER::draw( const DRAWSEGMENT* aSegment ) } -void PCB_PAINTER::draw( const MODULE* aModule, int aLayer ) -{ - // For modules we have to draw a selection box if needed - if( aLayer == ITEM_GAL_LAYER( SELECTION ) ) - { - if( aModule->IsSelected() ) - drawSelectionBox( aModule ); - } -} - - void PCB_PAINTER::draw( const TEXTE_PCB* aText, int aLayer ) { - if( aLayer == ITEM_GAL_LAYER( SELECTION ) ) - { - if( aText->IsSelected() ) - drawSelectionBox( aText ); - } - else - { - if( aText->GetText().Length() == 0 ) - return; + if( aText->GetText().Length() == 0 ) + return; - COLOR4D strokeColor = m_pcbSettings->GetColor( aText, aText->GetLayer() ); - VECTOR2D position( aText->GetTextPosition().x, aText->GetTextPosition().y ); - double orientation = aText->GetOrientation() * M_PI / 1800.0; + COLOR4D strokeColor = m_pcbSettings->GetColor( aText, aText->GetLayer() ); + VECTOR2D position( aText->GetTextPosition().x, aText->GetTextPosition().y ); + double orientation = aText->GetOrientation() * M_PI / 1800.0; - m_gal->SetStrokeColor( strokeColor ); - m_gal->SetLineWidth( aText->GetThickness() ); - m_gal->SetTextAttributes( aText ); - m_gal->StrokeText( std::string( aText->GetText().mb_str() ), position, orientation ); - } + m_gal->SetStrokeColor( strokeColor ); + m_gal->SetLineWidth( aText->GetThickness() ); + m_gal->SetTextAttributes( aText ); + m_gal->StrokeText( std::string( aText->GetText().mb_str() ), position, orientation ); } void PCB_PAINTER::draw( const TEXTE_MODULE* aText, int aLayer ) { - if( aLayer == ITEM_GAL_LAYER( SELECTION ) ) - { - if( aText->IsSelected() ) - drawSelectionBox( aText ); - } - else - { - if( aText->GetLength() == 0 ) - return; + if( aText->GetLength() == 0 ) + return; - COLOR4D strokeColor = m_pcbSettings->GetColor( aText, aLayer ); - VECTOR2D position( aText->GetTextPosition().x, aText->GetTextPosition().y ); - double orientation = aText->GetDrawRotation() * M_PI / 1800.0; - - m_gal->SetStrokeColor( strokeColor ); - m_gal->SetLineWidth( aText->GetThickness() ); - m_gal->SetTextAttributes( aText ); - m_gal->StrokeText( std::string( aText->GetText().mb_str() ), position, orientation ); - } + COLOR4D strokeColor = m_pcbSettings->GetColor( aText, aLayer ); + VECTOR2D position( aText->GetTextPosition().x, aText->GetTextPosition().y ); + double orientation = aText->GetDrawRotation() * M_PI / 1800.0; + m_gal->SetStrokeColor( strokeColor ); + m_gal->SetLineWidth( aText->GetThickness() ); + m_gal->SetTextAttributes( aText ); + m_gal->StrokeText( std::string( aText->GetText().mb_str() ), position, orientation ); } @@ -830,41 +797,32 @@ void PCB_PAINTER::draw( const ZONE_CONTAINER* aZone ) void PCB_PAINTER::draw( const DIMENSION* aDimension, int aLayer ) { - if( aLayer == ITEM_GAL_LAYER( SELECTION ) ) - { - if( aDimension->IsSelected() ) - drawSelectionBox( aDimension ); - } - else - { - int layer = aDimension->GetLayer(); - COLOR4D strokeColor = m_pcbSettings->GetColor( aDimension, layer ); + COLOR4D strokeColor = m_pcbSettings->GetColor( aDimension, aLayer ); - m_gal->SetStrokeColor( strokeColor ); - m_gal->SetIsFill( false ); - m_gal->SetIsStroke( true ); - m_gal->SetLineWidth( aDimension->GetWidth() ); + m_gal->SetStrokeColor( strokeColor ); + m_gal->SetIsFill( false ); + m_gal->SetIsStroke( true ); + m_gal->SetLineWidth( aDimension->GetWidth() ); - // Draw an arrow - m_gal->DrawLine( VECTOR2D( aDimension->m_crossBarO ), VECTOR2D( aDimension->m_crossBarF ) ); - m_gal->DrawLine( VECTOR2D( aDimension->m_featureLineGO ), - VECTOR2D( aDimension->m_featureLineGF ) ); - m_gal->DrawLine( VECTOR2D( aDimension->m_featureLineDO ), - VECTOR2D( aDimension->m_featureLineDF ) ); - m_gal->DrawLine( VECTOR2D( aDimension->m_arrowD1O ), VECTOR2D( aDimension->m_arrowD1F ) ); - m_gal->DrawLine( VECTOR2D( aDimension->m_arrowD2O ), VECTOR2D( aDimension->m_arrowD2F ) ); - m_gal->DrawLine( VECTOR2D( aDimension->m_arrowG1O ), VECTOR2D( aDimension->m_arrowG1F ) ); - m_gal->DrawLine( VECTOR2D( aDimension->m_arrowG2O ), VECTOR2D( aDimension->m_arrowG2F ) ); + // Draw an arrow + m_gal->DrawLine( VECTOR2D( aDimension->m_crossBarO ), VECTOR2D( aDimension->m_crossBarF ) ); + m_gal->DrawLine( VECTOR2D( aDimension->m_featureLineGO ), + VECTOR2D( aDimension->m_featureLineGF ) ); + m_gal->DrawLine( VECTOR2D( aDimension->m_featureLineDO ), + VECTOR2D( aDimension->m_featureLineDF ) ); + m_gal->DrawLine( VECTOR2D( aDimension->m_arrowD1O ), VECTOR2D( aDimension->m_arrowD1F ) ); + m_gal->DrawLine( VECTOR2D( aDimension->m_arrowD2O ), VECTOR2D( aDimension->m_arrowD2F ) ); + m_gal->DrawLine( VECTOR2D( aDimension->m_arrowG1O ), VECTOR2D( aDimension->m_arrowG1F ) ); + m_gal->DrawLine( VECTOR2D( aDimension->m_arrowG2O ), VECTOR2D( aDimension->m_arrowG2F ) ); - // Draw text - TEXTE_PCB& text = aDimension->Text(); - VECTOR2D position( text.GetTextPosition().x, text.GetTextPosition().y ); - double orientation = text.GetOrientation() * M_PI / 1800.0; + // Draw text + TEXTE_PCB& text = aDimension->Text(); + VECTOR2D position( text.GetTextPosition().x, text.GetTextPosition().y ); + double orientation = text.GetOrientation() * M_PI / 1800.0; - m_gal->SetLineWidth( text.GetThickness() ); - m_gal->SetTextAttributes( &text ); - m_gal->StrokeText( std::string( text.GetText().mb_str() ), position, orientation ); - } + m_gal->SetLineWidth( text.GetThickness() ); + m_gal->SetTextAttributes( &text ); + m_gal->StrokeText( std::string( text.GetText().mb_str() ), position, orientation ); } @@ -904,14 +862,4 @@ void PCB_PAINTER::draw( const PCB_TARGET* aTarget ) } -void PCB_PAINTER::drawSelectionBox( const VIEW_ITEM* aItem ) const -{ - BOX2I boundingBox = aItem->ViewBBox(); - - m_gal->SetIsStroke( false ); - m_gal->SetIsFill( true ); - m_gal->SetFillColor( m_pcbSettings->GetLayerColor( ITEM_GAL_LAYER( SELECTION ) ) ); - m_gal->DrawRectangle( boundingBox.GetOrigin(), boundingBox.GetEnd() ); -} - const double PCB_RENDER_SETTINGS::MAX_FONT_SIZE = 100000000; diff --git a/pcbnew/pcb_painter.h b/pcbnew/pcb_painter.h index 4532fc49b6..7f9844ee41 100644 --- a/pcbnew/pcb_painter.h +++ b/pcbnew/pcb_painter.h @@ -146,15 +146,11 @@ protected: void draw( const SEGVIA*, int ); void draw( const D_PAD*, int ); void draw( const DRAWSEGMENT* ); - void draw( const MODULE*, int ); void draw( const TEXTE_PCB*, int ); void draw( const TEXTE_MODULE*, int ); void draw( const ZONE_CONTAINER* ); void draw( const DIMENSION*, int ); void draw( const PCB_TARGET* ); - - /// Draws a white semitransparent box indicating an item as selected - void drawSelectionBox( const VIEW_ITEM* aItem ) const; }; } // namespace KiGfx diff --git a/pcbnew/pcbframe.cpp b/pcbnew/pcbframe.cpp index 67f905f5fc..a5b7b933ee 100644 --- a/pcbnew/pcbframe.cpp +++ b/pcbnew/pcbframe.cpp @@ -791,7 +791,7 @@ void PCB_EDIT_FRAME::setHighContrastLayer( LAYER_NUM aLayer ) GetNetnameLayer( aLayer ), ITEM_GAL_LAYER( VIAS_VISIBLE ), ITEM_GAL_LAYER( VIAS_HOLES_VISIBLE ), ITEM_GAL_LAYER( PADS_VISIBLE ), ITEM_GAL_LAYER( PADS_HOLES_VISIBLE ), ITEM_GAL_LAYER( PADS_NETNAMES_VISIBLE ), - ITEM_GAL_LAYER( SELECTION ), ITEM_GAL_LAYER( GP_OVERLAY ) + ITEM_GAL_LAYER( GP_OVERLAY ) }; for( unsigned int i = 0; i < sizeof( layers ) / sizeof( LAYER_NUM ); ++i ) @@ -831,7 +831,7 @@ void PCB_EDIT_FRAME::setTopLayer( LAYER_NUM aLayer ) GetNetnameLayer( aLayer ), ITEM_GAL_LAYER( VIAS_VISIBLE ), ITEM_GAL_LAYER( VIAS_HOLES_VISIBLE ), ITEM_GAL_LAYER( PADS_VISIBLE ), ITEM_GAL_LAYER( PADS_HOLES_VISIBLE ), ITEM_GAL_LAYER( PADS_NETNAMES_VISIBLE ), - ITEM_GAL_LAYER( SELECTION ), ITEM_GAL_LAYER( GP_OVERLAY ) + ITEM_GAL_LAYER( GP_OVERLAY ) }; for( unsigned int i = 0; i < sizeof( layers ) / sizeof( LAYER_NUM ); ++i ) diff --git a/pcbnew/tools/bright_box.h b/pcbnew/tools/bright_box.h index e1748dbd28..e07a4b37e1 100644 --- a/pcbnew/tools/bright_box.h +++ b/pcbnew/tools/bright_box.h @@ -52,7 +52,7 @@ public: } private: - static const int BrightBoxLayer = ITEM_GAL_LAYER( SELECTION ); + static const int BrightBoxLayer = ITEM_GAL_LAYER( GP_OVERLAY ); static const KiGfx::COLOR4D BrightColor; static const double LineWidth = 100000.0;