Read and update colour settings when changed in prefs.

Fixes https://gitlab.com/kicad/code/kicad/issues/5046
This commit is contained in:
Jeff Young 2020-08-02 18:42:35 +01:00
parent 7108a25278
commit 07ab97a58b
5 changed files with 24 additions and 5 deletions

View File

@ -64,6 +64,7 @@ void WS_RENDER_SETTINGS::LoadColors( const COLOR_SETTINGS* aSettings )
m_backgroundColor = aSettings->GetColor( LAYER_SCHEMATIC_BACKGROUND );
m_pageBorderColor = aSettings->GetColor( LAYER_SCHEMATIC_GRID );
m_normalColor = aSettings->GetColor( LAYER_SCHEMATIC_WORKSHEET );
}

View File

@ -44,7 +44,7 @@ namespace KIGFX
* WS_RENDER_SETTINGS
* Stores page-layout-specific render settings.
*/
class WS_RENDER_SETTINGS : public RENDER_SETTINGS
class WS_RENDER_SETTINGS : public RENDER_SETTINGS
{
public:
friend class WS_PAINTER;

View File

@ -51,9 +51,9 @@ PL_DRAW_PANEL_GAL::PL_DRAW_PANEL_GAL( wxWindow* aParentWindow, wxWindowID aWindo
m_painter = std::make_unique<KIGFX::WS_PAINTER>( m_gal );
auto cfg = Pgm().GetSettingsManager().GetAppSettings<PL_EDITOR_SETTINGS>();
m_painter->GetSettings()->LoadColors(
Pgm().GetSettingsManager().GetColorSettings( cfg->m_ColorTheme ) );
SETTINGS_MANAGER& settingsManager = Pgm().GetSettingsManager();
PL_EDITOR_SETTINGS* cfg = settingsManager.GetAppSettings<PL_EDITOR_SETTINGS>();
m_painter->GetSettings()->LoadColors( settingsManager.GetColorSettings( cfg->m_ColorTheme ) );
m_view->SetPainter( m_painter.get() );
m_view->SetScaleLimits( 20.0, 0.05 ); // This fixes the zoom in and zoom out limits

View File

@ -26,7 +26,7 @@
#include <fctsys.h>
#include <kiface_i.h>
#include <pgm_base.h>
#include <base_units.h>
//#include <base_units.h>
#include <msgpanel.h>
#include <bitmaps.h>
#include <dialogs/panel_pl_editor_color_settings.h>
@ -57,6 +57,7 @@
#include <invoke_pl_editor_dialog.h>
#include <tools/pl_editor_control.h>
#include <widgets/infobar.h>
#include <settings/settings_manager.h>
BEGIN_EVENT_TABLE( PL_EDITOR_FRAME, EDA_DRAW_FRAME )
EVT_CLOSE( PL_EDITOR_FRAME::OnCloseWindow )
@ -550,6 +551,21 @@ void PL_EDITOR_FRAME::SetTitleBlock( const TITLE_BLOCK& aTitleBlock )
}
void PL_EDITOR_FRAME::CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged )
{
EDA_DRAW_FRAME::CommonSettingsChanged( aEnvVarsChanged, aTextVarsChanged );
SETTINGS_MANAGER& settingsManager = Pgm().GetSettingsManager();
PL_EDITOR_SETTINGS* cfg = settingsManager.GetAppSettings<PL_EDITOR_SETTINGS>();
COLOR_SETTINGS* colors = settingsManager.GetColorSettings( cfg->m_ColorTheme );
GetCanvas()->GetView()->GetPainter()->GetSettings()->LoadColors( colors );
GetCanvas()->GetView()->UpdateAllItems( KIGFX::COLOR );
GetCanvas()->Refresh();
}
wxPoint PL_EDITOR_FRAME::ReturnCoordOriginCorner() const
{
// calculate the position (in page, in iu) of the corner used as coordinate origin

View File

@ -136,6 +136,8 @@ public:
const TITLE_BLOCK& GetTitleBlock() const override;
void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ) override;
void CommonSettingsChanged( bool aEnvVarsChanged, bool aTextVarsChanged ) override;
void DisplayGridMsg() override;
void UpdateStatusBar() override;