Fixes to grid color and some more CLangTidy fixes.

This commit is contained in:
Jeff Young 2018-09-16 14:07:20 +01:00
parent 0af31e1bf0
commit 929786ce50
3 changed files with 26 additions and 50 deletions

View File

@ -233,7 +233,6 @@ static PARAM_CFG_ARRAY& cfg_params()
CLR( "Color4DBrightenedEx", LAYER_BRIGHTENED, COLOR4D( PUREMAGENTA ) )
CLR( "Color4DHiddenEx", LAYER_HIDDEN, COLOR4D( LIGHTGRAY ) )
CLR( "Color4DWorksheetEx", LAYER_WORKSHEET, COLOR4D( RED ) )
CLR( "Color4DGridEx", LAYER_GRID, COLOR4D( DARKGRAY ) )
}
return ca;

View File

@ -317,26 +317,12 @@ const wxChar RescueNeverShowEntry[] = wxT( "RescueNeverShow" );
const wxChar AutoplaceFieldsEntry[] = wxT( "AutoplaceFields" );
const wxChar AutoplaceJustifyEntry[] = wxT( "AutoplaceJustify" );
const wxChar AutoplaceAlignEntry[] = wxT( "AutoplaceAlign" );
const wxChar SchIconScaleEntry[] = wxT( "SchIconScale" );
const wxChar LibIconScaleEntry[] = wxT( "LibIconScale" );
static const wxChar FootprintPreviewEntry[] = wxT( "FootprintPreview" );
static const wxChar DefaultBusWidthEntry[] = wxT( "DefaultBusWidth" );
static const wxChar DefaultDrawLineWidthEntry[] = wxT( "DefaultDrawLineWidth" );
static const wxChar DefaultJctSizeEntry[] = wxT( "DefaultJunctionSize" );
static const wxChar ShowHiddenPinsEntry[] = wxT( "ShowHiddenPins" );
static const wxChar HorzVertLinesOnlyEntry[] = wxT( "HorizVertLinesOnly" );
static const wxChar PreviewFramePositionXEntry[] = wxT( "PreviewFramePositionX" );
static const wxChar PreviewFramePositionYEntry[] = wxT( "PreviewFramePositionY" );
static const wxChar PreviewFrameWidthEntry[] = wxT( "PreviewFrameWidth" );
static const wxChar PreviewFrameHeightEntry[] = wxT( "PreviewFrameHeight" );
static const wxChar PrintDialogPositionXEntry[] = wxT( "PrintDialogPositionX" );
static const wxChar PrintDialogPositionYEntry[] = wxT( "PrintDialogPositionY" );
static const wxChar PrintDialogWidthEntry[] = wxT( "PrintDialogWidth" );
static const wxChar PrintDialogHeightEntry[] = wxT( "PrintDialogHeight" );
static const wxChar FindDialogPositionXEntry[] = wxT( "FindDialogPositionX" );
static const wxChar FindDialogPositionYEntry[] = wxT( "FindDialogPositionY" );
static const wxChar FindDialogWidthEntry[] = wxT( "FindDialogWidth" );
static const wxChar FindDialogHeightEntry[] = wxT( "FindDialogHeight" );
static const wxChar FindReplaceFlagsEntry[] = wxT( "LastFindReplaceFlags" );
static const wxChar FindStringEntry[] = wxT( "LastFindString" );
static const wxChar ReplaceStringEntry[] = wxT( "LastReplaceString" );
@ -406,11 +392,12 @@ void SCH_EDIT_FRAME::LoadSettings( wxConfigBase* aCfg )
wxConfigLoadSetups( aCfg, GetConfigurationSettings() );
SetGridColor( GetLayerColor( LAYER_SCHEMATIC_GRID ) );
GetGalCanvas()->GetView()->GetGAL()->SetGridColor( GetGridColor() );
SetDrawBgColor( GetLayerColor( LAYER_SCHEMATIC_BACKGROUND ) );
SetDefaultBusThickness( aCfg->Read( DefaultBusWidthEntry, DEFAULTBUSTHICKNESS ) );
SetDefaultLineThickness( aCfg->Read( DefaultDrawLineWidthEntry, DEFAULTDRAWLINETHICKNESS ) );
SCH_JUNCTION::SetSymbolSize( aCfg->Read( DefaultJctSizeEntry, SCH_JUNCTION::GetSymbolSize() ) );
SetDefaultBusThickness( (int) aCfg->Read( DefaultBusWidthEntry, DEFAULTBUSTHICKNESS ) );
SetDefaultLineThickness( (int) aCfg->Read( DefaultDrawLineWidthEntry, DEFAULTDRAWLINETHICKNESS ) );
SCH_JUNCTION::SetSymbolSize( (int) aCfg->Read( DefaultJctSizeEntry, SCH_JUNCTION::GetSymbolSize() ) );
aCfg->Read( ShowHiddenPinsEntry, &m_showAllPins, false );
aCfg->Read( HorzVertLinesOnlyEntry, &m_forceHVLines, true );
aCfg->Read( AutoplaceFieldsEntry, &m_autoplaceFields, true );
@ -537,17 +524,17 @@ void LIB_EDIT_FRAME::LoadSettings( wxConfigBase* aCfg )
SetGridColor( GetLayerColor( LAYER_SCHEMATIC_GRID ) );
SetDrawBgColor( GetLayerColor( LAYER_SCHEMATIC_BACKGROUND ) );
SetDefaultLineThickness( aCfg->Read( DefaultDrawLineWidthEntry, DEFAULTDRAWLINETHICKNESS ) );
SetDefaultPinLength( aCfg->Read( DefaultPinLengthEntry, DEFAULTPINLENGTH ) );
m_textPinNumDefaultSize = aCfg->Read( defaultPinNumSizeEntry, DEFAULTPINNUMSIZE );
m_textPinNameDefaultSize = aCfg->Read( defaultPinNameSizeEntry, DEFAULTPINNAMESIZE );
SetRepeatDeltaLabel( aCfg->Read( repeatLibLabelIncEntry, DEFAULT_REPEAT_LABEL_INC ) );
SetRepeatPinStep( aCfg->Read( pinRepeatStepEntry, DEFAULT_REPEAT_OFFSET_PIN ) );
SetDefaultLineThickness( (int) aCfg->Read( DefaultDrawLineWidthEntry, DEFAULTDRAWLINETHICKNESS ) );
SetDefaultPinLength( (int) aCfg->Read( DefaultPinLengthEntry, DEFAULTPINLENGTH ) );
m_textPinNumDefaultSize = (int) aCfg->Read( defaultPinNumSizeEntry, DEFAULTPINNUMSIZE );
m_textPinNameDefaultSize = (int) aCfg->Read( defaultPinNameSizeEntry, DEFAULTPINNAMESIZE );
SetRepeatDeltaLabel( (int) aCfg->Read( repeatLibLabelIncEntry, DEFAULT_REPEAT_LABEL_INC ) );
SetRepeatPinStep( (int) aCfg->Read( pinRepeatStepEntry, DEFAULT_REPEAT_OFFSET_PIN ) );
wxPoint step;
step.x = aCfg->Read( repeatLibStepXEntry, (long)DEFAULT_REPEAT_OFFSET_X );
step.y = aCfg->Read( repeatLibStepYEntry, (long)DEFAULT_REPEAT_OFFSET_Y );
step.x = (int) aCfg->Read( repeatLibStepXEntry, (long) DEFAULT_REPEAT_OFFSET_X );
step.y = (int) aCfg->Read( repeatLibStepYEntry, (long) DEFAULT_REPEAT_OFFSET_Y );
SetRepeatStep( step );
m_showPinElectricalTypeName = aCfg->Read( showPinElectricalType, true );
m_showPinElectricalTypeName = aCfg->ReadBool( showPinElectricalType, true );
wxString templateFieldNames = aCfg->Read( FieldNamesEntry, wxEmptyString );

View File

@ -28,7 +28,7 @@
#include <fctsys.h>
#include <draw_frame.h>
#include <sch_draw_panel.h>
#include <sch_view.h>
#include <general.h>
#include "widget_eeschema_color_config.h"
@ -271,46 +271,36 @@ void WIDGET_EESCHEMA_COLOR_CONFIG::SetColor( wxCommandEvent& event )
bool WIDGET_EESCHEMA_COLOR_CONFIG::TransferDataFromControl()
{
bool warning = false;
// Check for color conflicts with background color to give user a chance to bail
// out before making changes.
COLOR4D bgcolor = currentColors[ LAYER_SCHEMATIC_BACKGROUND ];
for( SCH_LAYER_ID clyr = LAYER_WIRE; clyr < SCH_LAYER_ID_END; ++clyr )
for( SCH_LAYER_ID clyr = SCH_LAYER_ID_START; clyr < SCH_LAYER_ID_END; ++clyr )
{
if( bgcolor == currentColors[ clyr ] && clyr != LAYER_SCHEMATIC_BACKGROUND )
{
warning = true;
wxString msg = _( "Some items have the same color as the background\n"
"and they will not be seen on the screen. Are you\n"
"sure you want to use these colors?" );
if( wxMessageBox( msg, _( "Warning" ), wxYES_NO | wxICON_QUESTION, this ) == wxNO )
return false;
break;
}
}
// Prompt the user if an item has the same color as the background
// because this item cannot be seen:
if( warning )
{
if( wxMessageBox( _( "Some items have the same color as the background\n"
"and they will not be seen on the screen. Are you\n"
"sure you want to use these colors?" ),
_( "Warning" ),
wxYES_NO | wxICON_QUESTION, this ) == wxNO )
return false;
}
// Update color of background
GetDrawFrame()->SetDrawBgColor( bgcolor );
currentColors[ LAYER_SCHEMATIC_BACKGROUND ] = bgcolor;
for( SCH_LAYER_ID clyr = LAYER_WIRE; clyr < SCH_LAYER_ID_END; ++clyr )
{
for( SCH_LAYER_ID clyr = SCH_LAYER_ID_START; clyr < SCH_LAYER_ID_END; ++clyr )
SetLayerColor( currentColors[ clyr ], clyr );
}
GetDrawFrame()->SetGridColor( GetLayerColor( LAYER_SCHEMATIC_GRID ) );
GetDrawFrame()->GetCanvas()->Refresh();
m_drawFrame->SetGridColor( GetLayerColor( LAYER_SCHEMATIC_GRID ) );
m_drawFrame->GetGalCanvas()->GetView()->GetGAL()->SetGridColor( m_drawFrame->GetGridColor() );
m_drawFrame->GetGalCanvas()->Refresh();
return true;
}