Save flip board status in custom preset

(cherry picked from commit 2d54bc42cb)
This commit is contained in:
Josue Huaroto 2023-09-12 17:10:41 +00:00 committed by Seth Hillbrand
parent 5f16f4ab99
commit 909d199379
2 changed files with 13 additions and 1 deletions

View File

@ -136,6 +136,7 @@ struct LAYER_PRESET
layers = LSET::AllLayersMask();
renderLayers = GAL_SET::DefaultVisible();
readOnly = false;
flipBoard = false;
}
LAYER_PRESET( const wxString& aName, const LSET& aVisibleLayers ) :
@ -145,6 +146,7 @@ struct LAYER_PRESET
{
renderLayers = GAL_SET::DefaultVisible();
readOnly = false;
flipBoard = false;
}
LAYER_PRESET( const wxString& aName, const LSET& aVisibleLayers, const GAL_SET& aVisibleObjects,
@ -154,7 +156,8 @@ struct LAYER_PRESET
renderLayers( aVisibleObjects ),
activeLayer( aActiveLayer )
{
readOnly = false;
readOnly = false;
flipBoard = false;
}
bool LayersMatch( const LAYER_PRESET& aOther )
@ -165,6 +168,7 @@ struct LAYER_PRESET
wxString name; ///< A name for this layer set
LSET layers; ///< Board layers that are visible
GAL_SET renderLayers; ///< Render layers (e.g. object types) that are visible
bool flipBoard; ///< True if the flip board is enabled
PCB_LAYER_ID activeLayer; ///< Optional layer to set active when this preset is loaded
bool readOnly; ///< True if this is a read-only (built-in) preset
};

View File

@ -2642,11 +2642,13 @@ void APPEARANCE_CONTROLS::onLayerPresetChanged( wxCommandEvent& aEvent )
if( !exists )
{
index = m_cbLayerPresets->Insert( name, index - 1, static_cast<void*>( preset ) );
preset->flipBoard = m_cbFlipBoard->GetValue();
}
else
{
preset->layers = getVisibleLayers();
preset->renderLayers = getVisibleObjects();
preset->flipBoard = m_cbFlipBoard->GetValue();
index = m_cbLayerPresets->FindString( name );
m_presetMRU.Remove( name );
@ -2758,6 +2760,12 @@ void APPEARANCE_CONTROLS::doApplyLayerPreset( const LAYER_PRESET& aPreset )
if( !m_isFpEditor )
m_frame->GetCanvas()->SyncLayersVisibility( board );
if( aPreset.flipBoard )
{
m_frame->GetCanvas()->GetView()->SetMirror( true, false );
m_frame->GetCanvas()->GetView()->RecacheAllItems();
}
m_frame->GetCanvas()->Refresh();
syncColorsAndVisibility();