7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-05 00:15:30 +00:00

Fix wiping out non-controlled GAL layer visibility

Fixes https://gitlab.com/kicad/code/kicad/-/issues/19544
This commit is contained in:
Jon Evans 2025-01-10 08:37:11 -05:00
parent ab5bdd2882
commit c6d8f4a62e
3 changed files with 42 additions and 2 deletions

View File

@ -83,7 +83,8 @@ PROJECT_LOCAL_SETTINGS::PROJECT_LOCAL_SETTINGS( PROJECT* aProject, const wxStrin
return;
}
m_VisibleItems.reset();
m_VisibleItems &= ~UserVisbilityLayers();
GAL_SET visible;
for( const nlohmann::json& entry : aVal )
{
@ -92,13 +93,15 @@ PROJECT_LOCAL_SETTINGS::PROJECT_LOCAL_SETTINGS( PROJECT* aProject, const wxStrin
std::string vs = entry.get<std::string>();
if( std::optional<GAL_LAYER_ID> l = RenderLayerFromVisbilityString( vs ) )
m_VisibleItems.set( *l );
visible.set( *l );
}
catch( ... )
{
// Non-integer or out of range entry in the array; ignore
}
}
m_VisibleItems |= UserVisbilityLayers() & visible;
},
{} ) );

View File

@ -19,9 +19,41 @@
#include <boost/algorithm/string/case_conv.hpp>
#include <magic_enum.hpp>
#include <core/arraydim.h>
#include <settings/layer_settings_utils.h>
GAL_SET UserVisbilityLayers()
{
static const GAL_LAYER_ID layers[] = {
LAYER_TRACKS,
LAYER_VIAS,
LAYER_PADS,
LAYER_ZONES,
LAYER_SHAPES,
LAYER_DRAW_BITMAPS,
LAYER_FOOTPRINTS_FR,
LAYER_FOOTPRINTS_BK,
LAYER_FP_VALUES,
LAYER_FP_REFERENCES,
LAYER_FP_TEXT,
LAYER_ANCHOR,
LAYER_RATSNEST,
LAYER_DRC_WARNING,
LAYER_DRC_ERROR,
LAYER_DRC_EXCLUSION,
LAYER_LOCKED_ITEM_SHADOW,
LAYER_CONFLICTS_SHADOW,
LAYER_DRAWINGSHEET,
LAYER_GRID,
};
static const GAL_SET saved( layers, arrayDim( layers ) );
return saved;
}
GAL_LAYER_ID RenderLayerFromVisibilityLayer( VISIBILITY_LAYER aLayer )
{
switch( aLayer )

View File

@ -53,6 +53,11 @@ enum class VISIBILITY_LAYER
GRID
};
/**
* The set of GAL_LAYER_IDs that correspond to VISIBILITY_LAYERS
*/
GAL_SET UserVisbilityLayers();
GAL_LAYER_ID RenderLayerFromVisibilityLayer( VISIBILITY_LAYER aLayer );
std::optional<VISIBILITY_LAYER> VisibilityLayerFromRenderLayer( GAL_LAYER_ID aLayerId );