26#include <wx/translation.h>
37 return aPreset.GetLayerPair().HasSameLayers( aPair ) && aPreset.IsEnabled();
40 return std::any_of( presets.begin(), presets.end(), matcher );
59 const bool alreadyExists = std::any_of(
m_pairs.begin(),
m_pairs.end(), pairMatcher );
73 m_pairs.push_back( std::move( aPairInfo ) );
82 wxCommandEvent* evt =
new wxCommandEvent( PCB_LAYER_PAIR_PRESETS_CHANGED, wxID_ANY );
92 return aPairInfo.GetLayerPair().HasSameLayers( aPair );
95 const auto pairToRemoveIt = std::find_if(
m_pairs.begin(),
m_pairs.end(), pairMatcher );
97 if( pairToRemoveIt ==
m_pairs.end() )
102 m_pairs.erase( pairToRemoveIt );
111 wxCommandEvent* evt =
new wxCommandEvent( PCB_LAYER_PAIR_PRESETS_CHANGED, wxID_ANY );
129 std::vector<LAYER_PAIR_INFO> enabledPairs;
149 if( pair.IsEnabled() )
151 enabledPairs.push_back( pair );
155 aCurrent = enabledPairs.size() - 1;
174 wxCommandEvent* evt =
new wxCommandEvent( PCB_LAYER_PAIR_PRESETS_CHANGED, wxID_ANY );
188 wxCommandEvent* evt =
new wxCommandEvent( PCB_CURRENT_LAYER_PAIR_CHANGED, wxID_ANY );
All information about a layer pair as stored in the layer pair store.
const LAYER_PAIR & GetLayerPair() const
Management class for layer pairs in a PCB.
std::vector< LAYER_PAIR_INFO > m_pairs
std::vector< LAYER_PAIR_INFO > GetEnabledLayerPairs(int &aCurrentIndex) const
Get a vector of all enabled layer pairs, in order.
bool removeLayerPairInternal(const LAYER_PAIR &aPair)
bool AddLayerPair(LAYER_PAIR_INFO aPair)
std::span< const LAYER_PAIR_INFO > GetLayerPairs() const
Returns a span of all stored layer pairs.
std::optional< LAYER_PAIR > m_lastManualPair
void SetCurrentLayerPair(const LAYER_PAIR &aPair)
Set the "active" layer pair.
void SetLayerPairs(std::span< const LAYER_PAIR_INFO > aPairs)
Replace the stored layer pairs with the given list.
bool RemoveLayerPair(const LAYER_PAIR &aPair)
Remove the matching layer pair from the store, if present.
bool addLayerPairInternal(LAYER_PAIR_INFO aPair)
LAYER_PAIR_SETTINGS()
Construct a new layer pair manager.
bool HasSameLayers(const LAYER_PAIR &aOther) const
static bool IsAnEnabledPreset(const LAYER_PAIR &aPair, const LAYER_PAIR_SETTINGS &aSettings)
wxDEFINE_EVENT(PCB_LAYER_PAIR_PRESETS_CHANGED, wxCommandEvent)