Fix saving of pcbnew colors when edited from layers widget
This commit is contained in:
parent
2d95270a31
commit
69db66e1ea
|
@ -158,7 +158,7 @@ void PANEL_COLOR_SETTINGS::OnThemeChanged( wxCommandEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PANEL_COLOR_SETTINGS::createThemeList( const COLOR_SETTINGS* aCurrent )
|
void PANEL_COLOR_SETTINGS::createThemeList( const wxString& aCurrent )
|
||||||
{
|
{
|
||||||
m_cbTheme->Clear();
|
m_cbTheme->Clear();
|
||||||
|
|
||||||
|
@ -166,7 +166,7 @@ void PANEL_COLOR_SETTINGS::createThemeList( const COLOR_SETTINGS* aCurrent )
|
||||||
{
|
{
|
||||||
int pos = m_cbTheme->Append( settings->GetName(), static_cast<void*>( settings ) );
|
int pos = m_cbTheme->Append( settings->GetName(), static_cast<void*>( settings ) );
|
||||||
|
|
||||||
if( settings == aCurrent )
|
if( settings->GetFilename() == aCurrent )
|
||||||
m_cbTheme->SetSelection( pos );
|
m_cbTheme->SetSelection( pos );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ protected:
|
||||||
|
|
||||||
void SetColor( wxCommandEvent& aEvent );
|
void SetColor( wxCommandEvent& aEvent );
|
||||||
|
|
||||||
void createThemeList( const COLOR_SETTINGS* aCurrent );
|
void createThemeList( const wxString& aCurrent );
|
||||||
|
|
||||||
void createButton( int aLayer, const KIGFX::COLOR4D& aColor, const wxString& aName );
|
void createButton( int aLayer, const KIGFX::COLOR4D& aColor, const wxString& aName );
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ PANEL_COLOR_SETTINGS_BASE::PANEL_COLOR_SETTINGS_BASE( wxWindow* parent, wxWindow
|
||||||
bControlSizer->Add( m_btnOpenFolder, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
bControlSizer->Add( m_btnOpenFolder, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||||
|
|
||||||
|
|
||||||
m_mainSizer->Add( bControlSizer, 0, wxEXPAND|wxRIGHT, 10 );
|
m_mainSizer->Add( bControlSizer, 0, wxEXPAND|wxLEFT|wxRIGHT, 10 );
|
||||||
|
|
||||||
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
|
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
|
||||||
m_mainSizer->Add( m_staticline1, 0, wxEXPAND|wxALL, 5 );
|
m_mainSizer->Add( m_staticline1, 0, wxEXPAND|wxALL, 5 );
|
||||||
|
|
|
@ -57,7 +57,7 @@
|
||||||
<property name="permission">protected</property>
|
<property name="permission">protected</property>
|
||||||
<object class="sizeritem" expanded="1">
|
<object class="sizeritem" expanded="1">
|
||||||
<property name="border">10</property>
|
<property name="border">10</property>
|
||||||
<property name="flag">wxEXPAND|wxRIGHT</property>
|
<property name="flag">wxEXPAND|wxLEFT|wxRIGHT</property>
|
||||||
<property name="proportion">0</property>
|
<property name="proportion">0</property>
|
||||||
<object class="wxBoxSizer" expanded="1">
|
<object class="wxBoxSizer" expanded="1">
|
||||||
<property name="minimum_size"></property>
|
<property name="minimum_size"></property>
|
||||||
|
|
|
@ -75,7 +75,7 @@ PANEL_EESCHEMA_COLOR_SETTINGS::PANEL_EESCHEMA_COLOR_SETTINGS( SCH_BASE_FRAME* aF
|
||||||
EESCHEMA_SETTINGS* app_settings = mgr.GetAppSettings<EESCHEMA_SETTINGS>();
|
EESCHEMA_SETTINGS* app_settings = mgr.GetAppSettings<EESCHEMA_SETTINGS>();
|
||||||
COLOR_SETTINGS* current = mgr.GetColorSettings( app_settings->m_ColorTheme );
|
COLOR_SETTINGS* current = mgr.GetColorSettings( app_settings->m_ColorTheme );
|
||||||
|
|
||||||
createThemeList( current );
|
createThemeList( app_settings->m_ColorTheme );
|
||||||
|
|
||||||
m_optOverrideColors->SetValue( current->GetOverrideSchItemColors() );
|
m_optOverrideColors->SetValue( current->GetOverrideSchItemColors() );
|
||||||
|
|
||||||
|
|
|
@ -45,23 +45,35 @@ PANEL_PCBNEW_COLOR_SETTINGS::PANEL_PCBNEW_COLOR_SETTINGS( PCB_EDIT_FRAME* aFrame
|
||||||
|
|
||||||
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
|
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
|
||||||
|
|
||||||
mgr.ReloadColorSettings();
|
|
||||||
|
|
||||||
PCBNEW_SETTINGS* app_settings = mgr.GetAppSettings<PCBNEW_SETTINGS>();
|
PCBNEW_SETTINGS* app_settings = mgr.GetAppSettings<PCBNEW_SETTINGS>();
|
||||||
COLOR_SETTINGS* current = mgr.GetColorSettings( app_settings->m_ColorTheme );
|
COLOR_SETTINGS* current = mgr.GetColorSettings( app_settings->m_ColorTheme );
|
||||||
|
|
||||||
|
// Store the current settings before reloading below
|
||||||
|
current->SetColorContext( COLOR_CONTEXT::PCB );
|
||||||
|
current->Store();
|
||||||
|
mgr.SaveColorSettings( current, "board" );
|
||||||
|
|
||||||
m_optOverrideColors->SetValue( current->GetOverrideSchItemColors() );
|
m_optOverrideColors->SetValue( current->GetOverrideSchItemColors() );
|
||||||
|
|
||||||
m_currentSettings = new COLOR_SETTINGS( *current );
|
m_currentSettings = new COLOR_SETTINGS( *current );
|
||||||
|
|
||||||
createThemeList( current );
|
mgr.ReloadColorSettings();
|
||||||
|
createThemeList( app_settings->m_ColorTheme );
|
||||||
for( int id = GAL_LAYER_ID_START; id < GAL_LAYER_ID_END; id++ )
|
|
||||||
m_validLayers.push_back( id );
|
|
||||||
|
|
||||||
for( int id = F_Cu; id < PCB_LAYER_ID_COUNT; id++ )
|
for( int id = F_Cu; id < PCB_LAYER_ID_COUNT; id++ )
|
||||||
m_validLayers.push_back( id );
|
m_validLayers.push_back( id );
|
||||||
|
|
||||||
|
for( int id = GAL_LAYER_ID_START; id < GAL_LAYER_ID_END; id++ )
|
||||||
|
{
|
||||||
|
if( id == LAYER_VIAS || id == LAYER_GRID_AXES || id == LAYER_PADS_PLATEDHOLES
|
||||||
|
|| id == LAYER_VIAS_HOLES )
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_validLayers.push_back( id );
|
||||||
|
}
|
||||||
|
|
||||||
m_colorsMainSizer->Insert( 0, 10, 0, 0, wxEXPAND, 5 );
|
m_colorsMainSizer->Insert( 0, 10, 0, 0, wxEXPAND, 5 );
|
||||||
|
|
||||||
createButtons();
|
createButtons();
|
||||||
|
|
|
@ -664,7 +664,6 @@ void PCB_EDIT_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
|
||||||
{
|
{
|
||||||
PCB_BASE_FRAME::SaveSettings( aCfg );
|
PCB_BASE_FRAME::SaveSettings( aCfg );
|
||||||
|
|
||||||
// TODO(JE) remove once color themes exist
|
|
||||||
COLOR_SETTINGS* cs = ColorSettings();
|
COLOR_SETTINGS* cs = ColorSettings();
|
||||||
cs->SetColorContext( COLOR_CONTEXT::PCB );
|
cs->SetColorContext( COLOR_CONTEXT::PCB );
|
||||||
cs->Store();
|
cs->Store();
|
||||||
|
|
|
@ -521,9 +521,10 @@ void PCB_LAYER_WIDGET::ReFill()
|
||||||
|
|
||||||
void PCB_LAYER_WIDGET::OnLayerColorChange( int aLayer, COLOR4D aColor )
|
void PCB_LAYER_WIDGET::OnLayerColorChange( int aLayer, COLOR4D aColor )
|
||||||
{
|
{
|
||||||
myframe->ColorSettings()->SetColorContext( m_fp_editor_mode ?
|
COLOR_SETTINGS* cs = myframe->ColorSettings();
|
||||||
COLOR_CONTEXT::FOOTPRINT : COLOR_CONTEXT::PCB );
|
cs->SetColorContext( m_fp_editor_mode ? COLOR_CONTEXT::FOOTPRINT : COLOR_CONTEXT::PCB );
|
||||||
myframe->ColorSettings()->SetColor( aLayer, aColor );
|
cs->SetColor( aLayer, aColor );
|
||||||
|
|
||||||
myframe->GetCanvas()->UpdateColors();
|
myframe->GetCanvas()->UpdateColors();
|
||||||
|
|
||||||
KIGFX::VIEW* view = myframe->GetCanvas()->GetView();
|
KIGFX::VIEW* view = myframe->GetCanvas()->GetView();
|
||||||
|
|
Loading…
Reference in New Issue