Added support for multiple active layers (colored ones in the high contrast mode).
Added separate layers for pad netnames (now these are divided into multilayer/top/bottom pads). More appropriate layers are selecting a copper layer in the high contrast mode (now it shows the copper layer itself, vias & multilayer pads and netnames).
This commit is contained in:
parent
0544134ae3
commit
7739cfef2f
|
@ -39,7 +39,6 @@ RENDER_SETTINGS::RENDER_SETTINGS()
|
|||
m_highlightEnabled = false;
|
||||
m_hiContrastEnabled = false;
|
||||
m_hiContrastFactor = 0.2;
|
||||
m_activeLayer = 0;
|
||||
m_outlineWidth = 1;
|
||||
|
||||
// Store the predefined colors used in KiCad in format used by GAL
|
||||
|
|
|
@ -431,6 +431,9 @@ void VIEW::EnableTopLayer( bool aEnable )
|
|||
for( it = m_topLayers.begin(); it != m_topLayers.end(); ++it )
|
||||
m_layers[*it].renderingOrder -= TOP_LAYER_MODIFIER;
|
||||
}
|
||||
|
||||
UpdateAllLayersOrder();
|
||||
UpdateAllLayersColor();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -236,6 +236,8 @@ enum PCB_VISIBLE
|
|||
LAYER_14_NETNAMES_VISIBLE,
|
||||
LAYER_15_NETNAMES_VISIBLE,
|
||||
LAYER_16_NETNAMES_VISIBLE, // Top layer
|
||||
PAD_FR_NETNAMES_VISIBLE,
|
||||
PAD_BK_NETNAMES_VISIBLE,
|
||||
PADS_NETNAMES_VISIBLE,
|
||||
|
||||
END_PCB_VISIBLE_LIST // sentinel
|
||||
|
@ -264,7 +266,7 @@ const int GalLayerOrder[] =
|
|||
ITEM_GAL_LAYER( VIAS_HOLES_VISIBLE ), ITEM_GAL_LAYER( PADS_HOLES_VISIBLE ),
|
||||
ITEM_GAL_LAYER( VIAS_VISIBLE ), ITEM_GAL_LAYER( PADS_VISIBLE ),
|
||||
|
||||
ITEM_GAL_LAYER( PAD_FR_VISIBLE ),
|
||||
ITEM_GAL_LAYER( PAD_FR_NETNAMES_VISIBLE ), ITEM_GAL_LAYER( PAD_FR_VISIBLE ),
|
||||
ITEM_GAL_LAYER( LAYER_16_NETNAMES_VISIBLE ), LAYER_N_FRONT,
|
||||
ITEM_GAL_LAYER( LAYER_15_NETNAMES_VISIBLE ), LAYER_N_15,
|
||||
ITEM_GAL_LAYER( LAYER_14_NETNAMES_VISIBLE ), LAYER_N_14,
|
||||
|
@ -281,7 +283,7 @@ const int GalLayerOrder[] =
|
|||
ITEM_GAL_LAYER( LAYER_3_NETNAMES_VISIBLE ), LAYER_N_3,
|
||||
ITEM_GAL_LAYER( LAYER_2_NETNAMES_VISIBLE ), LAYER_N_2,
|
||||
ITEM_GAL_LAYER( LAYER_1_NETNAMES_VISIBLE ), LAYER_N_BACK,
|
||||
ITEM_GAL_LAYER( PAD_BK_VISIBLE ),
|
||||
ITEM_GAL_LAYER( PAD_BK_NETNAMES_VISIBLE ), ITEM_GAL_LAYER( PAD_BK_VISIBLE ),
|
||||
|
||||
SOLDERMASK_N_BACK, ADHESIVE_N_BACK, SOLDERPASTE_N_BACK, SILKSCREEN_N_BACK,
|
||||
ITEM_GAL_LAYER( MOD_TEXT_BK_VISIBLE )
|
||||
|
@ -408,6 +410,10 @@ inline LAYER_NUM GetNetnameLayer( LAYER_NUM aLayer )
|
|||
}
|
||||
else if( aLayer == ITEM_GAL_LAYER( PADS_VISIBLE ) )
|
||||
return ITEM_GAL_LAYER( PADS_NETNAMES_VISIBLE );
|
||||
else if( aLayer == ITEM_GAL_LAYER( PAD_FR_VISIBLE ) )
|
||||
return ITEM_GAL_LAYER( PAD_FR_NETNAMES_VISIBLE );
|
||||
else if( aLayer == ITEM_GAL_LAYER( PAD_BK_VISIBLE ) )
|
||||
return ITEM_GAL_LAYER( PAD_BK_NETNAMES_VISIBLE );
|
||||
|
||||
// Fallback
|
||||
return COMMENT_N;
|
||||
|
|
|
@ -27,8 +27,8 @@
|
|||
#ifndef __CLASS_PAINTER_H
|
||||
#define __CLASS_PAINTER_H
|
||||
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <set>
|
||||
|
||||
#include <gal/color4d.h>
|
||||
#include <colors.h>
|
||||
|
@ -51,8 +51,6 @@ class VIEW_ITEM;
|
|||
* - drawing quality control (sketch/outline mode)
|
||||
* The class acts as an interface between the PAINTER object and the GUI (i.e. Layers/Items
|
||||
* widget or display options dialog).
|
||||
*
|
||||
* Todo: properties/introspection
|
||||
*/
|
||||
class RENDER_SETTINGS
|
||||
{
|
||||
|
@ -81,9 +79,21 @@ public:
|
|||
* (eg. highlighted, so it differs from other layers).
|
||||
* @param aLayerId is a layer number that should be displayed in a specific mode.
|
||||
*/
|
||||
inline void SetActiveLayer( int aLayerId )
|
||||
inline void SetActiveLayer( int aLayerId, bool aEnabled = true )
|
||||
{
|
||||
m_activeLayer = aLayerId;
|
||||
if( aEnabled )
|
||||
m_activeLayers.insert( aLayerId );
|
||||
else
|
||||
m_activeLayers.erase( aLayerId );
|
||||
}
|
||||
|
||||
/**
|
||||
* Function ClearActiveLayers
|
||||
* Clears the list of active layers.
|
||||
*/
|
||||
inline void ClearActiveLayers()
|
||||
{
|
||||
m_activeLayers.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -112,8 +122,7 @@ public:
|
|||
}
|
||||
|
||||
protected:
|
||||
|
||||
int m_activeLayer; /// Stores active layer number
|
||||
std::set<unsigned int> m_activeLayers; /// Stores active layers number
|
||||
|
||||
/// Parameters for display modes
|
||||
bool m_hiContrastEnabled; /// High contrast display mode on/off
|
||||
|
|
|
@ -133,7 +133,15 @@ protected:
|
|||
* will change the currently active layer to \a aLayer and also
|
||||
* update the PCB_LAYER_WIDGET.
|
||||
*/
|
||||
void setActiveLayer( LAYER_NUM aLayer, bool doLayerWidgetUpdate = true );
|
||||
void setActiveLayer( LAYER_NUM aLayer, bool doLayerWidgetUpdate = true )
|
||||
{
|
||||
( (PCB_SCREEN*) GetScreen() )->m_Active_Layer = aLayer;
|
||||
|
||||
setHighContrastLayer( aLayer );
|
||||
|
||||
if( doLayerWidgetUpdate )
|
||||
syncLayerWidgetLayer();
|
||||
}
|
||||
|
||||
/**
|
||||
* Function getActiveLayer
|
||||
|
@ -144,6 +152,12 @@ protected:
|
|||
return ( (PCB_SCREEN*) GetScreen() )->m_Active_Layer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function setHighContrastLayer
|
||||
* takes care of display settings for the given layer to be displayed in high contrast mode.
|
||||
*/
|
||||
void setHighContrastLayer( LAYER_NUM aLayer );
|
||||
|
||||
/**
|
||||
* Function syncLayerWidgetLayer
|
||||
* updates the currently layer "selection" within the PCB_LAYER_WIDGET.
|
||||
|
|
|
@ -203,11 +203,10 @@ void PCB_BASE_FRAME::SetBoard( BOARD* aBoard )
|
|||
|
||||
// Netnames are drawn only when scale is sufficient (level of details)
|
||||
// so there is no point in caching them
|
||||
for( LAYER_NUM layer = FIRST_COPPER_LAYER; layer <= LAST_COPPER_LAYER; ++layer )
|
||||
for( LAYER_NUM layer = FIRST_NETNAME_LAYER; layer <= LAST_NETNAME_LAYER; ++layer )
|
||||
{
|
||||
view->SetLayerCached( GetNetnameLayer( layer ), false );
|
||||
view->SetLayerCached( layer, false );
|
||||
}
|
||||
view->SetLayerCached( ITEM_GAL_LAYER( PADS_NETNAMES_VISIBLE ), false );
|
||||
|
||||
// Load layer & elements visibility settings
|
||||
for( unsigned int i = 0; i < NB_LAYERS; ++i )
|
||||
|
|
|
@ -748,48 +748,32 @@ void D_PAD::ViewGetLayers( int aLayers[], int& aCount ) const
|
|||
{
|
||||
aCount = 0;
|
||||
|
||||
if( m_Attribute == PAD_SMD || m_Attribute == PAD_CONN )
|
||||
if( IsOnLayer( LAYER_N_FRONT ) && IsOnLayer( LAYER_N_BACK ) )
|
||||
{
|
||||
// Single layer pad (smd) without hole
|
||||
if( IsOnLayer( LAYER_N_FRONT ) )
|
||||
aLayers[aCount++] = ITEM_GAL_LAYER( PAD_FR_VISIBLE );
|
||||
else if( IsOnLayer( LAYER_N_BACK ) )
|
||||
aLayers[aCount++] = ITEM_GAL_LAYER( PAD_BK_VISIBLE );
|
||||
#ifdef __WXDEBUG__
|
||||
else // Should not occur
|
||||
{
|
||||
wxLogWarning( wxT("D_PAD::ViewGetLayers():PAD on layer different than FRONT/BACK") );
|
||||
}
|
||||
#endif
|
||||
// Multi layer pad
|
||||
aLayers[aCount++] = ITEM_GAL_LAYER( PADS_VISIBLE );
|
||||
aLayers[aCount++] = ITEM_GAL_LAYER( PADS_NETNAMES_VISIBLE );
|
||||
}
|
||||
else
|
||||
else if( IsOnLayer( LAYER_N_FRONT ) )
|
||||
{
|
||||
if( IsOnLayer( LAYER_N_FRONT ) && IsOnLayer( LAYER_N_BACK ) )
|
||||
{
|
||||
// Multi layer pad
|
||||
aLayers[aCount++] = ITEM_GAL_LAYER( PADS_VISIBLE );
|
||||
}
|
||||
else if( IsOnLayer( LAYER_N_FRONT ) )
|
||||
{
|
||||
aLayers[aCount++] = ITEM_GAL_LAYER( PAD_FR_VISIBLE );
|
||||
}
|
||||
else if( IsOnLayer( LAYER_N_BACK ) )
|
||||
{
|
||||
aLayers[aCount++] = ITEM_GAL_LAYER( PAD_BK_VISIBLE );
|
||||
}
|
||||
aLayers[aCount++] = ITEM_GAL_LAYER( PAD_FR_VISIBLE );
|
||||
aLayers[aCount++] = ITEM_GAL_LAYER( PAD_FR_NETNAMES_VISIBLE );
|
||||
}
|
||||
else if( IsOnLayer( LAYER_N_BACK ) )
|
||||
{
|
||||
aLayers[aCount++] = ITEM_GAL_LAYER( PAD_BK_VISIBLE );
|
||||
aLayers[aCount++] = ITEM_GAL_LAYER( PAD_BK_NETNAMES_VISIBLE );
|
||||
}
|
||||
#ifdef __WXDEBUG__
|
||||
else // Should not occur
|
||||
{
|
||||
wxLogWarning( wxT("D_PAD::ViewGetLayers():PAD on layer different than FRONT/BACK") );
|
||||
}
|
||||
else // Should not occur
|
||||
{
|
||||
wxLogWarning( wxT("D_PAD::ViewGetLayers():PAD on layer different than FRONT/BACK") );
|
||||
}
|
||||
#endif
|
||||
|
||||
// Draw a hole
|
||||
// These types of pads contain a hole
|
||||
if( m_Attribute == PAD_STANDARD || m_Attribute == PAD_HOLE_NOT_PLATED )
|
||||
aLayers[aCount++] = ITEM_GAL_LAYER( PADS_HOLES_VISIBLE );
|
||||
}
|
||||
|
||||
// Pad description layer (number & net)
|
||||
aLayers[aCount++] = ITEM_GAL_LAYER( PADS_NETNAMES_VISIBLE );
|
||||
}
|
||||
|
||||
|
||||
|
@ -805,7 +789,7 @@ void D_PAD::ViewGetRequiredLayers( int aLayers[], int& aCount ) const
|
|||
unsigned int D_PAD::ViewGetLOD( int aLayer ) const
|
||||
{
|
||||
// Netnames will be shown only if zoom is appropriate
|
||||
if( aLayer == ITEM_GAL_LAYER( PADS_NETNAMES_VISIBLE ) )
|
||||
if( IsNetnameLayer( aLayer ) )
|
||||
{
|
||||
return ( 100000000 / std::max( m_Size.x, m_Size.y ) );
|
||||
}
|
||||
|
|
|
@ -199,35 +199,35 @@ void PCB_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
|
|||
case ID_TB_OPTIONS_SHOW_ZONES:
|
||||
DisplayOpt.DisplayZonesMode = 0;
|
||||
recache = true;
|
||||
if( !IsGalCanvasActive() )
|
||||
if( !m_galCanvasActive )
|
||||
m_canvas->Refresh();
|
||||
break;
|
||||
|
||||
case ID_TB_OPTIONS_SHOW_ZONES_DISABLE:
|
||||
DisplayOpt.DisplayZonesMode = 1;
|
||||
recache = true;
|
||||
if( !IsGalCanvasActive() )
|
||||
if( !m_galCanvasActive )
|
||||
m_canvas->Refresh();
|
||||
break;
|
||||
|
||||
case ID_TB_OPTIONS_SHOW_ZONES_OUTLINES_ONLY:
|
||||
DisplayOpt.DisplayZonesMode = 2;
|
||||
recache = true;
|
||||
if( !IsGalCanvasActive() )
|
||||
if( !m_galCanvasActive )
|
||||
m_canvas->Refresh();
|
||||
break;
|
||||
|
||||
case ID_TB_OPTIONS_SHOW_VIAS_SKETCH:
|
||||
m_DisplayViaFill = DisplayOpt.DisplayViaFill = !state;
|
||||
recache = true;
|
||||
if( !IsGalCanvasActive() )
|
||||
if( !m_galCanvasActive )
|
||||
m_canvas->Refresh();
|
||||
break;
|
||||
|
||||
case ID_TB_OPTIONS_SHOW_TRACKS_SKETCH:
|
||||
m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill = !state;
|
||||
recache = true;
|
||||
if( !IsGalCanvasActive() )
|
||||
if( !m_galCanvasActive )
|
||||
m_canvas->Refresh();
|
||||
break;
|
||||
|
||||
|
@ -238,19 +238,12 @@ void PCB_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
|
|||
// Apply new display options to the GAL canvas (this is faster than recaching)
|
||||
settings->LoadDisplayOptions( DisplayOpt );
|
||||
|
||||
KiGfx::VIEW* view = m_galCanvas->GetView();
|
||||
LAYER_NUM layer = getActiveLayer();
|
||||
setHighContrastLayer( getActiveLayer() );
|
||||
m_galCanvas->GetView()->EnableTopLayer( state );
|
||||
|
||||
view->GetPainter()->GetSettings()->SetActiveLayer( layer );
|
||||
view->UpdateAllLayersColor();
|
||||
if( m_galCanvasActive )
|
||||
m_galCanvas->Refresh();
|
||||
|
||||
view->EnableTopLayer( state );
|
||||
view->ClearTopLayers();
|
||||
view->SetTopLayer( layer );
|
||||
view->UpdateAllLayersOrder();
|
||||
|
||||
if( !IsGalCanvasActive() )
|
||||
m_canvas->Refresh();
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -73,6 +73,8 @@ void PCB_RENDER_SETTINGS::ImportLegacyColors( COLORS_DESIGN_SETTINGS* aSettings
|
|||
m_itemColors[VIAS_VISIBLE] = COLOR4D( 0.7, 0.7, 0.7, 1.0 );
|
||||
m_itemColors[PADS_VISIBLE] = COLOR4D( 0.7, 0.7, 0.7, 1.0 );
|
||||
m_itemColors[PADS_NETNAMES_VISIBLE] = COLOR4D( 0.8, 0.8, 0.8, 0.7 );
|
||||
m_itemColors[PAD_FR_NETNAMES_VISIBLE] = COLOR4D( 0.8, 0.8, 0.8, 0.7 );
|
||||
m_itemColors[PAD_BK_NETNAMES_VISIBLE] = COLOR4D( 0.8, 0.8, 0.8, 0.7 );
|
||||
// Netnames for copper layers
|
||||
for( LAYER_NUM layer = FIRST_COPPER_LAYER; layer <= LAST_COPPER_LAYER; ++layer )
|
||||
{
|
||||
|
@ -156,7 +158,7 @@ const COLOR4D& PCB_PAINTER::GetColor( const VIEW_ITEM* aItem, int aLayer )
|
|||
|
||||
const COLOR4D& PCB_PAINTER::getLayerColor( int aLayer, int aNetCode ) const
|
||||
{
|
||||
if( m_pcbSettings->m_hiContrastEnabled && m_pcbSettings->m_activeLayer != aLayer )
|
||||
if( m_pcbSettings->m_hiContrastEnabled && m_pcbSettings->m_activeLayers.count( aLayer ) == 0 )
|
||||
{
|
||||
return m_pcbSettings->m_hiContrastColor;
|
||||
}
|
||||
|
@ -376,7 +378,7 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer )
|
|||
orientation = orientation * M_PI / 1800.0;
|
||||
|
||||
// Draw description layer
|
||||
if( aLayer == ITEM_GAL_LAYER( PADS_NETNAMES_VISIBLE ) )
|
||||
if( IsNetnameLayer( aLayer ) )
|
||||
{
|
||||
size = VECTOR2D( aPad->GetSize() / 2 );
|
||||
double scale = m_gal->GetZoomFactor();
|
||||
|
|
|
@ -743,28 +743,57 @@ bool PCB_EDIT_FRAME::IsMicroViaAcceptable( void )
|
|||
}
|
||||
|
||||
|
||||
void PCB_EDIT_FRAME::setActiveLayer( LAYER_NUM aLayer, bool doLayerWidgetUpdate )
|
||||
void PCB_EDIT_FRAME::setHighContrastLayer( LAYER_NUM aLayer )
|
||||
{
|
||||
( (PCB_SCREEN*) GetScreen() )->m_Active_Layer = aLayer;
|
||||
|
||||
// Set display settings for high contrast mode
|
||||
KiGfx::VIEW* view = m_galCanvas->GetView();
|
||||
KiGfx::RENDER_SETTINGS* rSettings = view->GetPainter()->GetSettings();
|
||||
|
||||
if( DisplayOpt.ContrastModeDisplay )
|
||||
{
|
||||
view->GetPainter()->GetSettings()->SetActiveLayer( aLayer );
|
||||
view->UpdateAllLayersColor();
|
||||
|
||||
view->ClearTopLayers();
|
||||
view->SetTopLayer( aLayer );
|
||||
|
||||
rSettings->ClearActiveLayers();
|
||||
rSettings->SetActiveLayer( aLayer );
|
||||
|
||||
if( IsCopperLayer( aLayer ) )
|
||||
{
|
||||
// Bring some other layers to the front in case of copper layers and make them colored
|
||||
LAYER_NUM layers[] = {
|
||||
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 )
|
||||
};
|
||||
|
||||
for( unsigned int i = 0; i < sizeof( layers ) / sizeof( LAYER_NUM ); ++i )
|
||||
{
|
||||
view->SetTopLayer( layers[i] );
|
||||
rSettings->SetActiveLayer( layers[i] );
|
||||
}
|
||||
|
||||
// Pads should be shown too
|
||||
if( aLayer == FIRST_COPPER_LAYER )
|
||||
{
|
||||
view->SetTopLayer( ITEM_GAL_LAYER( PAD_BK_VISIBLE ) );
|
||||
view->SetTopLayer( ITEM_GAL_LAYER( PAD_BK_NETNAMES_VISIBLE ) );
|
||||
rSettings->SetActiveLayer( ITEM_GAL_LAYER( PAD_BK_VISIBLE ) );
|
||||
rSettings->SetActiveLayer( ITEM_GAL_LAYER( PAD_BK_NETNAMES_VISIBLE ) );
|
||||
}
|
||||
else if( aLayer == LAST_COPPER_LAYER )
|
||||
{
|
||||
view->SetTopLayer( ITEM_GAL_LAYER( PAD_FR_VISIBLE ) );
|
||||
view->SetTopLayer( ITEM_GAL_LAYER( PAD_FR_NETNAMES_VISIBLE ) );
|
||||
rSettings->SetActiveLayer( ITEM_GAL_LAYER( PAD_FR_VISIBLE ) );
|
||||
rSettings->SetActiveLayer( ITEM_GAL_LAYER( PAD_FR_NETNAMES_VISIBLE ) );
|
||||
}
|
||||
}
|
||||
view->UpdateAllLayersOrder();
|
||||
view->UpdateAllLayersColor();
|
||||
|
||||
if( m_galCanvasActive )
|
||||
m_galCanvas->Refresh();
|
||||
}
|
||||
|
||||
if( doLayerWidgetUpdate )
|
||||
syncLayerWidgetLayer();
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue