Alternative to cherry-picking b70df18939.

Fixes: lp:1838158
* https://bugs.launchpad.net/kicad/+bug/1838158
This commit is contained in:
Jeff Young 2019-07-29 20:18:30 -06:00
parent d34b664933
commit c8278f377b
3 changed files with 27 additions and 17 deletions

View File

@ -306,6 +306,13 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
m_Layers = nullptr; m_Layers = nullptr;
m_FrameSize = ConvertDialogToPixels( wxSize( 500, 350 ) ); // default in case of no prefs m_FrameSize = ConvertDialogToPixels( wxSize( 500, 350 ) ); // default in case of no prefs
m_previous_requested_scale = 0;
m_previous_active_layer_color = COLOR4D::UNSPECIFIED;
m_previous_Route_Layer_TOP_color = COLOR4D::UNSPECIFIED;
m_previous_Route_Layer_BOTTOM_color = COLOR4D::UNSPECIFIED;
m_previous_via_color = COLOR4D::UNSPECIFIED;
m_previous_background_color = COLOR4D::UNSPECIFIED;
// We don't know what state board was in when it was lasat saved, so we have to // We don't know what state board was in when it was lasat saved, so we have to
// assume dirty // assume dirty
m_ZoneFillsDirty = true; m_ZoneFillsDirty = true;

View File

@ -100,6 +100,14 @@ protected:
wxString m_lastNetListRead; ///< Last net list read with relative path. wxString m_lastNetListRead; ///< Last net list read with relative path.
// For PrepareLayerIndicator():
int m_previous_requested_scale;
COLOR4D m_previous_active_layer_color;
COLOR4D m_previous_Route_Layer_TOP_color;
COLOR4D m_previous_Route_Layer_BOTTOM_color;
COLOR4D m_previous_via_color;
COLOR4D m_previous_background_color;
// The Tool Framework initalization // The Tool Framework initalization
void setupTools(); void setupTools();

View File

@ -98,60 +98,55 @@ void PCB_EDIT_FRAME::PrepareLayerIndicator()
Route_Layer_BOTTOM_color, via_color, background_color; Route_Layer_BOTTOM_color, via_color, background_color;
bool change = false; bool change = false;
static int previous_requested_scale;
static COLOR4D previous_active_layer_color, previous_Route_Layer_TOP_color,
previous_Route_Layer_BOTTOM_color, previous_via_color,
previous_background_color;
int requested_scale; int requested_scale;
Pgm().CommonSettings()->Read( ICON_SCALE_KEY, &requested_scale, 0 ); Pgm().CommonSettings()->Read( ICON_SCALE_KEY, &requested_scale, 0 );
if( requested_scale != previous_requested_scale ) if( requested_scale != m_previous_requested_scale )
{ {
previous_requested_scale = requested_scale; m_previous_requested_scale = requested_scale;
change = true; change = true;
} }
active_layer_color = Settings().Colors().GetLayerColor(GetActiveLayer()); active_layer_color = Settings().Colors().GetLayerColor(GetActiveLayer());
if( previous_active_layer_color != active_layer_color ) if( m_previous_active_layer_color != active_layer_color )
{ {
previous_active_layer_color = active_layer_color; m_previous_active_layer_color = active_layer_color;
change = true; change = true;
} }
Route_Layer_TOP_color = Route_Layer_TOP_color =
Settings().Colors().GetLayerColor( GetScreen()->m_Route_Layer_TOP ); Settings().Colors().GetLayerColor( GetScreen()->m_Route_Layer_TOP );
if( previous_Route_Layer_TOP_color != Route_Layer_TOP_color ) if( m_previous_Route_Layer_TOP_color != Route_Layer_TOP_color )
{ {
previous_Route_Layer_TOP_color = Route_Layer_TOP_color; m_previous_Route_Layer_TOP_color = Route_Layer_TOP_color;
change = true; change = true;
} }
Route_Layer_BOTTOM_color = Route_Layer_BOTTOM_color =
Settings().Colors().GetLayerColor( GetScreen()->m_Route_Layer_BOTTOM ); Settings().Colors().GetLayerColor( GetScreen()->m_Route_Layer_BOTTOM );
if( previous_Route_Layer_BOTTOM_color != Route_Layer_BOTTOM_color ) if( m_previous_Route_Layer_BOTTOM_color != Route_Layer_BOTTOM_color )
{ {
previous_Route_Layer_BOTTOM_color = Route_Layer_BOTTOM_color; m_previous_Route_Layer_BOTTOM_color = Route_Layer_BOTTOM_color;
change = true; change = true;
} }
int via_type = GetDesignSettings().m_CurrentViaType; int via_type = GetDesignSettings().m_CurrentViaType;
via_color = Settings().Colors().GetItemColor( LAYER_VIAS + via_type ); via_color = Settings().Colors().GetItemColor( LAYER_VIAS + via_type );
if( previous_via_color != via_color ) if( m_previous_via_color != via_color )
{ {
previous_via_color = via_color; m_previous_via_color = via_color;
change = true; change = true;
} }
background_color = Settings().Colors().GetItemColor( LAYER_PCB_BACKGROUND ); background_color = Settings().Colors().GetItemColor( LAYER_PCB_BACKGROUND );
if( previous_background_color != background_color ) if( m_previous_background_color != background_color )
{ {
previous_background_color = background_color; m_previous_background_color = background_color;
change = true; change = true;
} }