GAL: Add a selected item layer

The selected items should be displayed above the rest of the items but
below informational overlays.

Fixes: lp:1789505
* https://bugs.launchpad.net/kicad/+bug/1789505
This commit is contained in:
Seth Hillbrand 2018-08-28 14:57:31 -07:00
parent f4eaf55497
commit dc4125206b
6 changed files with 16 additions and 10 deletions

View File

@ -41,7 +41,7 @@
using namespace KIGFX;
VIEW_GROUP::VIEW_GROUP( VIEW* aView ) :
m_layer( LAYER_GP_OVERLAY )
m_layer( LAYER_SELECT_OVERLAY )
{
}

View File

@ -193,9 +193,10 @@ enum GAL_LAYER_ID: int
LAYER_DRC, ///< drc markers
LAYER_WORKSHEET, ///< worksheet frame
LAYER_GP_OVERLAY, ///< general purpose overlay
LAYER_SELECT_OVERLAY, ///< currently selected items overlay
LAYER_PCB_BACKGROUND, ///< PCB background color
LAYER_CURSOR, ///< PCB cursor
LAYER_AUX_ITEMS, ///< Auxillary items (guides, rule, etc)
LAYER_AUX_ITEMS, ///< Auxiliary items (guides, rule, etc)
/// This is the end of the layers used for visibility bitmasks in Pcbnew
/// There can be at most 32 layers above here.
@ -305,6 +306,7 @@ enum GERBVIEW_LAYER_ID: int
#define MIN_VISIBILITY_MASK int( ( 1 << GAL_LAYER_INDEX( LAYER_PADS_PLATEDHOLES ) ) +\
( 1 << GAL_LAYER_INDEX( LAYER_VIAS_HOLES ) ) +\
( 1 << GAL_LAYER_INDEX( LAYER_DRC ) ) +\
( 1 << GAL_LAYER_INDEX( LAYER_SELECT_OVERLAY ) ) +\
( 1 << GAL_LAYER_INDEX( LAYER_GP_OVERLAY ) ) )

View File

@ -49,6 +49,7 @@ const LAYER_NUM GAL_LAYER_ORDER[] =
LAYER_GP_OVERLAY,
LAYER_DRC,
LAYER_PADS_NETNAMES, LAYER_VIAS_NETNAMES,
LAYER_SELECT_OVERLAY,
Dwgs_User, Cmts_User, Eco1_User, Eco2_User, Edge_Cuts,
LAYER_MOD_TEXT_FR,
@ -212,8 +213,8 @@ void PCB_DRAW_PANEL_GAL::SetHighContrastLayer( PCB_LAYER_ID aLayer )
GetNetnameLayer( aLayer ),
LAYER_VIA_THROUGH, LAYER_VIAS_HOLES, LAYER_VIAS_NETNAMES,
LAYER_PADS_TH, LAYER_PADS_PLATEDHOLES, LAYER_PADS_NETNAMES,
LAYER_NON_PLATEDHOLES, LAYER_GP_OVERLAY, LAYER_RATSNEST,
LAYER_CURSOR
LAYER_NON_PLATEDHOLES, LAYER_SELECT_OVERLAY, LAYER_GP_OVERLAY,
LAYER_RATSNEST, LAYER_CURSOR
};
for( unsigned int i = 0; i < sizeof( layers ) / sizeof( LAYER_NUM ); ++i )
@ -248,8 +249,8 @@ void PCB_DRAW_PANEL_GAL::SetTopLayer( PCB_LAYER_ID aLayer )
const LAYER_NUM layers[] = {
LAYER_VIA_THROUGH, LAYER_VIAS_HOLES, LAYER_VIAS_NETNAMES,
LAYER_PADS_TH, LAYER_PADS_PLATEDHOLES, LAYER_PADS_NETNAMES,
LAYER_NON_PLATEDHOLES, LAYER_GP_OVERLAY, LAYER_RATSNEST,
LAYER_DRC
LAYER_NON_PLATEDHOLES, LAYER_SELECT_OVERLAY, LAYER_GP_OVERLAY,
LAYER_RATSNEST, LAYER_DRC
};
for( unsigned int i = 0; i < sizeof( layers ) / sizeof( LAYER_NUM ); ++i )
@ -312,6 +313,7 @@ void PCB_DRAW_PANEL_GAL::SyncLayersVisibility( const BOARD* aBoard )
m_view->SetLayerVisible( LAYER_PADS_PLATEDHOLES, true );
m_view->SetLayerVisible( LAYER_VIAS_HOLES, true );
m_view->SetLayerVisible( LAYER_GP_OVERLAY, true );
m_view->SetLayerVisible( LAYER_SELECT_OVERLAY, true );
}
@ -454,6 +456,8 @@ void PCB_DRAW_PANEL_GAL::setDefaultLayerDeps()
m_view->SetRequired( LAYER_MOD_TEXT_BK, LAYER_MOD_BK );
m_view->SetRequired( LAYER_PAD_BK_NETNAMES, LAYER_PAD_BK );
m_view->SetLayerTarget( LAYER_SELECT_OVERLAY , KIGFX::TARGET_OVERLAY );
m_view->SetLayerDisplayOnly( LAYER_SELECT_OVERLAY ) ;
m_view->SetLayerTarget( LAYER_GP_OVERLAY , KIGFX::TARGET_OVERLAY );
m_view->SetLayerDisplayOnly( LAYER_GP_OVERLAY ) ;
m_view->SetLayerTarget( LAYER_RATSNEST, KIGFX::TARGET_OVERLAY );

View File

@ -376,7 +376,7 @@ public:
return;
m_items = new KIGFX::VIEW_GROUP( m_view );
m_items->SetLayer( LAYER_GP_OVERLAY ) ;
m_items->SetLayer( LAYER_SELECT_OVERLAY ) ;
m_view->Add( m_items );
}
@ -1218,7 +1218,7 @@ void PNS_KICAD_IFACE::SetView( KIGFX::VIEW* aView )
m_view = aView;
m_previewItems = new KIGFX::VIEW_GROUP( m_view );
m_previewItems->SetLayer( LAYER_GP_OVERLAY ) ;
m_previewItems->SetLayer( LAYER_SELECT_OVERLAY ) ;
m_view->Add( m_previewItems );
delete m_debugDecorator;

View File

@ -43,7 +43,7 @@ ROUTER_PREVIEW_ITEM::ROUTER_PREVIEW_ITEM( const PNS::ITEM* aItem, KIGFX::VIEW* a
m_shape = NULL;
m_clearance = -1;
m_originLayer = m_layer = LAYER_GP_OVERLAY ;
m_originLayer = m_layer = LAYER_SELECT_OVERLAY ;
m_showTrackClearance = false;
m_showViaClearance = false;

View File

@ -1411,7 +1411,7 @@ BOARD_ITEM* SELECTION_TOOL::doSelectionMenu( GENERAL_COLLECTOR* aCollector,
SELECTION highlightGroup;
CONTEXT_MENU menu;
highlightGroup.SetLayer( LAYER_GP_OVERLAY );
highlightGroup.SetLayer( LAYER_SELECT_OVERLAY );
getView()->Add( &highlightGroup );
int limit = std::min( 9, aCollector->GetCount() );