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 fcc4a84e0e)
This commit is contained in:
John Beard 2019-04-27 14:53:20 +01:00
parent 65a6e341ad
commit 454585d3d2
2 changed files with 23 additions and 1 deletions

View File

@ -24,6 +24,7 @@
#include <gal/gal_display_options.h>
#include <wx/config.h>
#include <wx/log.h>
#include <config_map.h>
#include <dpi_scaling.h>
@ -50,6 +51,16 @@ static const UTIL::CFG_MAP<KIGFX::GRID_STYLE> 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 );
}

View File

@ -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;