mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-04-14 20:09:35 +00:00
Pcbnew: rebuild layer preset list on language change
And initialise from the translations in the first place. Fixes: https://gitlab.com/kicad/code/kicad/-/issues/19181
This commit is contained in:
parent
37469b00b2
commit
f9238f58f4
@ -580,6 +580,7 @@ APPEARANCE_CONTROLS::APPEARANCE_CONTROLS( PCB_BASE_FRAME* aParent, wxWindow* aFo
|
||||
m_paneNetDisplayOptions->Expand();
|
||||
|
||||
loadDefaultLayerPresets();
|
||||
rebuildLayerPresetsWidget();
|
||||
rebuildObjects();
|
||||
OnBoardChanged();
|
||||
|
||||
@ -1457,7 +1458,6 @@ void APPEARANCE_CONTROLS::SetUserLayerPresets( std::vector<LAYER_PRESET>& aPrese
|
||||
void APPEARANCE_CONTROLS::loadDefaultLayerPresets()
|
||||
{
|
||||
m_layerPresets.clear();
|
||||
m_presetMRU.clear();
|
||||
|
||||
// Load the read-only defaults
|
||||
for( const LAYER_PRESET& preset :
|
||||
@ -1466,8 +1466,6 @@ void APPEARANCE_CONTROLS::loadDefaultLayerPresets()
|
||||
{
|
||||
m_layerPresets[preset.name] = preset;
|
||||
m_layerPresets[preset.name].readOnly = true;
|
||||
|
||||
m_presetMRU.Add( preset.name );
|
||||
}
|
||||
}
|
||||
|
||||
@ -2574,6 +2572,7 @@ void APPEARANCE_CONTROLS::rebuildLayerPresetsWidget()
|
||||
KeyNameFromKeyCode( PRESET_SWITCH_KEY ) ) );
|
||||
|
||||
m_cbLayerPresets->Clear();
|
||||
m_presetMRU.clear();
|
||||
|
||||
// Build the layers preset list.
|
||||
// By default, the presetAllLayers will be selected
|
||||
@ -2582,8 +2581,10 @@ void APPEARANCE_CONTROLS::rebuildLayerPresetsWidget()
|
||||
|
||||
for( std::pair<const wxString, LAYER_PRESET>& pair : m_layerPresets )
|
||||
{
|
||||
m_cbLayerPresets->Append( wxGetTranslation( pair.first ),
|
||||
const wxString translatedName = wxGetTranslation( pair.first );
|
||||
m_cbLayerPresets->Append( wxGetTranslation( translatedName ),
|
||||
static_cast<void*>( &pair.second ) );
|
||||
m_presetMRU.push_back( translatedName );
|
||||
|
||||
if( pair.first == presetAllLayers.name )
|
||||
default_idx = idx;
|
||||
@ -2821,8 +2822,10 @@ void APPEARANCE_CONTROLS::onLayerPresetChanged( wxCommandEvent& aEvent )
|
||||
|
||||
if( !m_currentPreset->name.IsEmpty() )
|
||||
{
|
||||
m_presetMRU.Remove( m_currentPreset->name );
|
||||
m_presetMRU.Insert( m_currentPreset->name, 0 );
|
||||
const wxString translatedName = wxGetTranslation( m_currentPreset->name );
|
||||
|
||||
m_presetMRU.Remove( translatedName );
|
||||
m_presetMRU.Insert( translatedName, 0 );
|
||||
}
|
||||
|
||||
passOnFocus();
|
||||
|
Loading…
Reference in New Issue
Block a user