APPEARANCE_CONTROLS, preset layers: re-allow storing object visibility in
a User preset, and use the last defined object visibility when switching to a builtin preset Fixes #15282 https://gitlab.com/kicad/code/kicad/-/issues/15282
This commit is contained in:
parent
1b0dea069b
commit
e188b5f8f4
|
@ -388,6 +388,10 @@ LAYER_PRESET APPEARANCE_CONTROLS::presetBack( _HKI( "Back Layers" ),
|
|||
LAYER_PRESET APPEARANCE_CONTROLS::presetBackAssembly( _HKI( "Back Assembly View" ),
|
||||
LSET::BackAssembly().set( Edge_Cuts ), GAL_SET::DefaultVisible(), B_SilkS );
|
||||
|
||||
// this one is only used to store the object visibility settings of the last used
|
||||
// built-in layer preset
|
||||
LAYER_PRESET APPEARANCE_CONTROLS::m_lastBuiltinPreset;
|
||||
|
||||
|
||||
APPEARANCE_CONTROLS::APPEARANCE_CONTROLS( PCB_BASE_FRAME* aParent, wxWindow* aFocusOwner,
|
||||
bool aFpEditorMode ) :
|
||||
|
@ -2692,6 +2696,14 @@ void APPEARANCE_CONTROLS::onLayerPresetChanged( wxCommandEvent& aEvent )
|
|||
return;
|
||||
}
|
||||
|
||||
// Store the objects visibility settings if the presedt is not a user preset,
|
||||
// to be reused when selecting a new built-in layer preset, even if a previous
|
||||
// user preset has changed the object visibility
|
||||
if( !m_currentPreset || m_currentPreset->readOnly )
|
||||
{
|
||||
m_lastBuiltinPreset.renderLayers = getVisibleObjects();
|
||||
}
|
||||
|
||||
LAYER_PRESET* preset = static_cast<LAYER_PRESET*>( m_cbLayerPresets->GetClientData( index ) );
|
||||
m_currentPreset = preset;
|
||||
|
||||
|
@ -2701,7 +2713,12 @@ void APPEARANCE_CONTROLS::onLayerPresetChanged( wxCommandEvent& aEvent )
|
|||
{
|
||||
// Change board layers visibility, but do not change objects visibility
|
||||
LAYER_PRESET curr_layers_choice = *preset;
|
||||
curr_layers_choice.renderLayers = getVisibleObjects();
|
||||
|
||||
// For predefined presets that do not manage objects visibility, use
|
||||
// the objects visibility settings of the last used predefined preset.
|
||||
if( curr_layers_choice.readOnly )
|
||||
curr_layers_choice.renderLayers = m_lastBuiltinPreset.renderLayers;
|
||||
|
||||
doApplyLayerPreset( curr_layers_choice );
|
||||
}
|
||||
|
||||
|
|
|
@ -430,6 +430,9 @@ private:
|
|||
static LAYER_PRESET presetFrontAssembly;
|
||||
static LAYER_PRESET presetBack;
|
||||
static LAYER_PRESET presetBackAssembly;
|
||||
// a LAYER_PRESET used only to store the objects visibility of the
|
||||
// last selected built-in LAYER_PRESET preset
|
||||
static LAYER_PRESET m_lastBuiltinPreset;
|
||||
|
||||
int m_pointSize;
|
||||
|
||||
|
|
Loading…
Reference in New Issue