From 454585d3d2094b49895d8537055ffafc4327615d Mon Sep 17 00:00:00 2001 From: John Beard Date: Sat, 27 Apr 2019 14:53:20 +0100 Subject: [PATCH] GAL: add some trace to GAL display options config This can be helpful when tracing where certain configurations come from (some apps load from other apps' config basenames). (cherry picked from commit fcc4a84e0e8dad368390d8732a4b3ffb6f01bdf0) --- common/gal/gal_display_options.cpp | 21 +++++++++++++++++++++ eeschema/viewlib_frame.cpp | 3 ++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/common/gal/gal_display_options.cpp b/common/gal/gal_display_options.cpp index 62c4ead449..23cc0782b9 100644 --- a/common/gal/gal_display_options.cpp +++ b/common/gal/gal_display_options.cpp @@ -24,6 +24,7 @@ #include #include +#include #include #include @@ -50,6 +51,16 @@ static const UTIL::CFG_MAP gridStyleConfigVals = }; +/** + * Flag to enable GAL_DISPLAY_OPTIONS loggin + * + * Use "KICAD_GAL_DISPLAY_OPTIONS" to enable. + * + * @ingroup trace_env_vars + */ +static const wxChar* traceGalDispOpts = wxT( "KICAD_GAL_DISPLAY_OPTIONS" ); + + GAL_DISPLAY_OPTIONS::GAL_DISPLAY_OPTIONS() : gl_antialiasing_mode( OPENGL_ANTIALIASING_MODE::NONE ), cairo_antialiasing_mode( CAIRO_ANTIALIASING_MODE::NONE ), @@ -67,6 +78,8 @@ void GAL_DISPLAY_OPTIONS::ReadAppConfig( wxConfigBase& aCfg, const wxString& aBa { const wxString baseName = aBaseName + GAL_DISPLAY_OPTIONS_KEY; + wxLogTrace( traceGalDispOpts, "Reading options with base name '%s'", baseName ); + long readLong; // Temp value buffer aCfg.Read( baseName + GalGridStyleConfig, &readLong, @@ -85,6 +98,8 @@ void GAL_DISPLAY_OPTIONS::ReadAppConfig( wxConfigBase& aCfg, const wxString& aBa void GAL_DISPLAY_OPTIONS::ReadCommonConfig( wxConfigBase& aCommonConfig, wxWindow* aWindow ) { + wxLogTrace( traceGalDispOpts, "Reading common config" ); + int temp; aCommonConfig.Read( GAL_ANTIALIASING_MODE_KEY, &temp, (int) KIGFX::OPENGL_ANTIALIASING_MODE::NONE ); @@ -106,6 +121,8 @@ void GAL_DISPLAY_OPTIONS::ReadCommonConfig( wxConfigBase& aCommonConfig, wxWindo void GAL_DISPLAY_OPTIONS::ReadConfig( wxConfigBase& aCommonConfig, wxConfigBase& aAppConfig, const wxString& aBaseCfgName, wxWindow* aWindow ) { + wxLogTrace( traceGalDispOpts, "Reading common and app config (%s)", aBaseCfgName ); + ReadAppConfig( aAppConfig, aBaseCfgName ); ReadCommonConfig( aCommonConfig, aWindow ); @@ -116,6 +133,8 @@ void GAL_DISPLAY_OPTIONS::WriteConfig( wxConfigBase& aCfg, const wxString& aBase { const wxString baseName = aBaseName + GAL_DISPLAY_OPTIONS_KEY; + wxLogTrace( traceGalDispOpts, "Writing app config (%s)", baseName ); + aCfg.Write( baseName + GalGridStyleConfig, UTIL::GetConfigForVal( gridStyleConfigVals, m_gridStyle ) ); @@ -129,5 +148,7 @@ void GAL_DISPLAY_OPTIONS::WriteConfig( wxConfigBase& aCfg, const wxString& aBase void GAL_DISPLAY_OPTIONS::NotifyChanged() { + wxLogTrace( traceGalDispOpts, "Change notification" ); + Notify( &GAL_DISPLAY_OPTIONS_OBSERVER::OnGalDisplayOptionsChanged, *this ); } \ No newline at end of file diff --git a/eeschema/viewlib_frame.cpp b/eeschema/viewlib_frame.cpp index 7e0396cabf..40be73cc74 100644 --- a/eeschema/viewlib_frame.cpp +++ b/eeschema/viewlib_frame.cpp @@ -726,7 +726,8 @@ void LIB_VIEW_FRAME::LoadSettings( wxConfigBase* aCfg ) { EDA_DRAW_FRAME::LoadSettings( aCfg ); - // Fetch grid settings from Symbol Editor + // Fetch display settings from Symbol Editor as the Symbol Viewer + // doesn't have its own config wxString symbolEditor = LIB_EDIT_FRAME_NAME; bool btmp; COLOR4D wtmp;