Better defaults for brightness factors

Also store them in the JSON so they can be tweaked
This commit is contained in:
Jon Evans 2020-08-18 20:44:01 -04:00
parent 8bca145b75
commit eb9756840d
4 changed files with 26 additions and 1 deletions

View File

@ -71,6 +71,15 @@ APP_SETTINGS_BASE::APP_SETTINGS_BASE( const std::string& aFilename, int aSchemaV
&m_Graphics.canvas_type, EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO ) );
#endif
m_params.emplace_back( new PARAM<float>(
"graphics.highlight_factor", &m_Graphics.highlight_factor, 0.5f, 0.0, 1.0f ) );
m_params.emplace_back( new PARAM<float>(
"graphics.select_factor", &m_Graphics.select_factor, 0.75f, 0.0, 1.0f ) );
m_params.emplace_back( new PARAM<float>(
"graphics.high_contrast_factor", &m_Graphics.high_contrast_factor, 0.35f, 0.0, 1.0f ) );
m_params.emplace_back( new PARAM<int>( "color_picker.default_tab",
&m_ColorPicker.default_tab, 0 ) );

View File

@ -228,6 +228,10 @@ public:
m_outlineWidth = aWidth;
}
void SetHighlightFactor( float aFactor ) { m_highlightFactor = aFactor; }
void SetSelectFactor( float aFactor ) { m_selectFactor = aFactor; }
void SetHighContrastFactor( float aFactor ) { m_hiContrastFactor = aFactor; }
// TODO: these can go away once we have Cairo-based printing
wxDC* GetPrintDC() { return m_printDC; }
void SetPrintDC( wxDC* aDC ) { m_printDC = aDC; }

View File

@ -106,6 +106,9 @@ public:
struct GRAPHICS
{
int canvas_type;
float highlight_factor; ///< How much to brighten highlighted objects by
float select_factor; ///< How much to brighten selected objects by
float high_contrast_factor; ///< How much to darken inactive layers by
};
struct COLOR_PICKER

View File

@ -652,6 +652,15 @@ void PCB_BASE_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg )
m_DisplayOptions = cfg->m_Display;
m_PolarCoords = cfg->m_PolarCoords;
}
RENDER_SETTINGS* rs = GetCanvas()->GetView()->GetPainter()->GetSettings();
if( rs )
{
rs->SetHighlightFactor( aCfg->m_Graphics.highlight_factor );
rs->SetSelectFactor( aCfg->m_Graphics.select_factor );
rs->SetHighContrastFactor( aCfg->m_Graphics.high_contrast_factor );
}
}