diff --git a/include/project/board_project_settings.h b/include/project/board_project_settings.h index 4fdd8e0dc1..7055dd49d7 100644 --- a/include/project/board_project_settings.h +++ b/include/project/board_project_settings.h @@ -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 }; diff --git a/pcbnew/widgets/appearance_controls.cpp b/pcbnew/widgets/appearance_controls.cpp index b1fbb147ad..a2294a0d89 100644 --- a/pcbnew/widgets/appearance_controls.cpp +++ b/pcbnew/widgets/appearance_controls.cpp @@ -2645,11 +2645,13 @@ void APPEARANCE_CONTROLS::onLayerPresetChanged( wxCommandEvent& aEvent ) if( !exists ) { index = m_cbLayerPresets->Insert( name, index - 1, static_cast( 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 ); @@ -2761,6 +2763,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();